It is injective because if $g(s)=g(t)$, $s<t$, then you can remove the interval $[s,t]$ from the domain of definition of $g$ and make the curve shorter. Then you rescale the domain to be $[0,1]$. Rescaling does not change the length of the curve. See also Lemma 3.10 in my notes linked to the answer to another related question: https://mathoverflow.net/questions/295446/does-there-always-exists-a-path-g0-1-rightarrow-x-from-f0-to-f1-th?rq=1