Homotopy equivalence induces bijection between path components
I'll call the function $F$ instead of $G$, since we have maps $f$ and $g$ and the function is induced by $f$. First, you should show that $F$ is well-defined. The problem with these types of definitions is that when you write $F(C(x))=C(f(x))$, then in order to determine the image of the component $C(x)$ you choose a point $x\in C(x)$ and then take $f(x)$. But if $C(x)=C(y)$, we could as well have chosen $y\in C(y)$, so we have to show that $F(C(x))=F(C(y))$. Okay, but this is trivial since $C(x)=C(y)$ is a connected set containing both $x$ and $y$, so $f[C(x)]$ is connected set containing $f(x)$ and $f(y)$, hence $C(f(x))=C(f(y))$.
Then you want to show bijectivity. We can do this by showing injectivity and surjectivity. But often it is advisable to construct a function $G$ in the other direction and prove this $G$ to be a both-sided inverse of $F$, especially when we already have a map $g:Y\to X$, then we can consider the function $G:C(Y)\to C(X)$ which is induced the same way as $F$.
Now since $GF(C(x))=C(gf(x))$, you only need to check that $gf(x)$ and $x$ are in the same component. More generally you could show that whenever $h\simeq h':X\to Z$, the induced functions $H,H'$ on the set of path components are equal, and then apply this to the special case $h=gf$, $h'=\text{Id}_X$.