Be careful: A homotopy equivalence is by no means a bijection in general: Let $X = \mathbb{R}$ and $Y = \{\ast\}$. Also, a homotopy equivalence need not restrict to a homotopy equivalence of subspaces. For instance, the orthogonal projection of $\mathbb{R}^2$ onto the $x$ axis is a homotopy equivalence. However, it maps the unit circle to the interval $[-1,1]$ and these two spaces certainly aren't homotopy equivalent (but this isn't completely obvious). Even simpler, take the subspace $([-1,1] \times \{0\}) \cup ([-1,1] \times \{1\})$ of $\mathbb{R}^2$ and its image $[-1,1]$ under the projection: you'll get a contradiction to your exercise.
The expressions $gf \simeq \operatorname{id}_{X}$ and $fg \simeq \operatorname{id}_{Y}$ mean that $gf$ and $fg$ are homotopic to the respective identities. (btw: it is more customary to use $\simeq$ \simeq
instead of $\cong$ for "homotopic")
A continuous map sends path components into path components (because it sends paths to paths). The path component of a point $x$ is sent into the path component of its image $f(x)$ and the path component of $f(x)$ is sent into the path component of $gf(x)$. But as $gf \simeq \operatorname{id}_{X}$, a homotopy $H: X \times [0,1] \to X$ such that $H(\cdot,0) = gf$ and $H(\cdot,1) = \operatorname{id}_{X}$ gives us the path $\gamma(t) = H(x,t)$ connecting $gf(x)$ with $x$, so the path component of $gf(x)$ is the same as the path component of $x$. I let you finish up the argument yourself.
Added in response to the edited question.
Let $[x]$ be the path component of $x$. Let me write $f_{\ast}: \pi_{0}(X) \to \pi_{0}(Y)$ instead of $f^\ast$. By definition $f_{\ast}[x] = [f(x)]$ (check that this is well-defined!). In my last paragraph above I argued that $[gf(x)] = [x]$ so $g_\ast f_\ast [x] = [x]$ (check that $(gf)_\ast = g_\ast f_\ast$!). In other words $g_\ast f_\ast = (\operatorname{id}_{X})_{\ast} = \operatorname{id}_{\pi_{0}(X)}$ (check that $(\operatorname{id}_X)_\ast = \operatorname{id}_{\pi_{0}(X)}$!). In particular, $f_{\ast}$ is injective and $g_\ast$ is surjective. By symmetry we have $f_\ast g_\ast = \operatorname{id}_{\pi_{0}(Y)}$, so $f_{\ast}$ and $g_\ast$ are mutually inverse bijections.
A bit later
Maybe it's better to start from scratch.
Define an equivalence relation on $X$ by $x \sim x'$ if and only if there is a path connecting $x$ and $x'$. The equivalence classes of $\sim$ are precisely the path components of $X$. In other words, $\pi_{0}(X) = X/\!\!\sim$. Write $[x]$ for the $\sim$-equivalence class of $x$ (so $[x]$ is the path component of $x$).
Fact 1: A continuous map $f: X \to Y$ sends path components into path components. In other words, if $x \sim x$ then $f(x) \sim f(x')$.
Indeed, if $\gamma: [0,1] \to X$ is a path with $\gamma(0) = x$ and $\gamma(1) = x'$ then $f \circ \gamma: [0,1] \to Y$ is a path and $f(\gamma(0)) = f(x)$ and $f(\gamma(1)) = f(x')$, so $f(x) \sim f(x')$.
Again in other words Fact 1 tells us that $f$ yields a map $f_{\ast}: \pi_{0}(X) \to \pi_{0}(Y)$. Explicitly,
\[
f_{\ast}([x]) = [f(x)].
\]
This is well-defined because for $x \sim x'$ we have $f(x) \sim f(x')$, so $[f(x)] = [f(x')]$.
From this description we see that $(\operatorname{id}_{X})_{\ast}([x]) = [\operatorname{id}_{X}(x)] = [x] = \operatorname{id}_{\pi_{0}(X)}([x])$, so $(\operatorname{id}_{X})_{\ast} = \operatorname{id}_{\pi_{0}(X)}$. Also $(gf)_{\ast}([x]) = [gf(x)] = g_{\ast}([f(x)]) = g_{\ast}f_{\ast}([x])$, so $(gf)_{\ast} = g_{\ast}f_{\ast}$.
Since the two identities I've just proven are so important, let me state them again for emphasis:
Fact 2: For the identity $\operatorname{id}_{X}: X \to X$ and any two maps $f:X \to Y$ and $g: Y \to Z$
we have $$\displaystyle
(\operatorname{id}_{X})_{\ast} = \operatorname{id}_{\pi_{0}(X)}:
\pi_{0}(X) \to \pi_{0}(X) \qquad\text{and}\qquad (gf)_{\ast} = g_\ast f_\ast : \pi_{0}(X) \to \pi_{0}(Z)
$$
Fact 3: If $f, f': X \to Y$ are homotopic, $f \simeq f'$, then $f_{\ast} = f'_{\ast}: \pi_{0}(X) \to \pi_{0}(Y)$.
Indeed, pick a homotopy $H: X \times [0,1] \to Y$ such that $f = H(\cdot,0)$ and $f' = H(\cdot,1)$. Since $t \mapsto H(x,t)$ is a path connecting $f(x)$ to $f'(x)$ we see that $f(x) \sim f'(x)$, so $f_{\ast}[x] = [f(x)] = [f'(x)] = f'_\ast[x]$.
Now we are finally in shape to solve the exercise. Let $f: X \to Y$ and $g: Y \to X$ be such that $gf \simeq \operatorname{id}_{X}$ and $fg \simeq \operatorname{id}_{Y}$. Then combining facts 2 and 3 we have that
$$\displaystyle
(\operatorname{id}_{X})_\ast = g_{\ast} f_{\ast}
\qquad \text{and}\qquad
(\operatorname{id}_{Y})_\ast = f_{\ast} g_{\ast}
$$
and as $(\operatorname{id}_X)_\ast = \operatorname{id}_{\pi_{0}(X)}$ we see that $f_{\ast}$ and $g_{\ast}$ are mutually inverse bijections.
I will first prove two lemmas. These are obvious results, and you should use these extensively.
Lemma 1. Let $\alpha,\beta:X \to Y$ and $\gamma:Y \to Z$ be continuous maps. If $\alpha \simeq \beta$ then $\gamma \alpha \simeq \gamma \beta$.
Proof. If $F$ is a homotopy between $\alpha$ and $\beta$, then $\gamma F$ is a homotopy between $\gamma \alpha$ and $\gamma \beta $, as you may easily check.
Lemma 2. Let $\alpha:X \to Y$ and $\beta, \gamma:Y \to Z$ be continuous maps. If $\beta \simeq \gamma$ then $ \beta \alpha \simeq \gamma \alpha$.
Proof. If $G$ is a homotopy between $\beta $ and $\gamma$, then $G \circ (\alpha \times id_I):X \times I \to Y \times I \to Z$ is a homotopy between $ \beta \alpha$ and $ \gamma \alpha$.
Now we claim that $g \simeq h$. This will imply $gf \simeq hf \simeq id_X$, and then combining with the assumption $fg \simeq id_Y$, the result follows. But our claim is obvious since $h=h\circ id_Y \simeq h(fg)=(hf)g \simeq id_X \circ g=g$.
Best Answer
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$.