This answer tries to work out some hints, and they do work (thanks Yves!).
For very complicated reasons $f$ is quite likely to be (a composition of a homeomorphism of [0,1] and) the exponential map: $C_G(g)$ has the structure of a Riemannian manifold, and obviously the fastest way to get from $1$ to $g$ is a geodesic, which are given by the Riemannian exponential, which happens to also be the Lie exponential.
This answer gives an example of matrix that is not in the image of the exponential map (quite possibly the wrong exponential map, but I'll just hope everything works out) for the group $G=\operatorname{SL}_2(\mathbb{C})$:
$g = \begin{bmatrix} -1 & 1 \\ 0 & -1 \end{bmatrix}$.
The only matrices that commute with $g$ are those of the form $x(a,b) = \begin{bmatrix} a & b \\ 0 & a \end{bmatrix}$. This, $C_G(g) = \{ x(a,b) : a = \pm1, b \in \mathbb{C} \}$, is not a compact group, and is not path connected.
For $G=\operatorname{GL}_2(\mathbb{C})$, $f$ would be easy: $f(t) = x( 2t-1, 1-t )$. $f$ is continuous, $f(0)=x(-1,1) = g$, $f(1) = x(1,0) = 1$, and $f(t) \cdot g = g \cdot f(t)$ since $x(a,b) \cdot g = g \cdot x(a,b)$. However, for $G=\operatorname{SL}_2(\mathbb{C})$ we have $C_G(g)$ has two components, and $g$ does not lie in the identity component.