If 2 spaces are homotopy equivalent, then their fundamental group is the same
If two maps $\varphi, \psi : (X, x_0) \to (Y, y_0)$ are homotopic, then the induced maps $\varphi_*, \psi_* : \pi_1(X, x_0) \to \pi_1(Y, y_0)$ are equal. It doesn't make sense to say that the induced maps are homotopic (as your question suggests), since the induced maps are group homomorphisms, not continuous maps between topological spaces.
Once we know this, it's easy to prove the statement in your question. Since $f \circ g \simeq \operatorname{id}_Y$, we have $$ (f \circ g)_* = f_* \circ g_* = (\operatorname{id}_Y)_* = \operatorname{id}_{\pi_1(Y, y_0)}. $$
Similarly, since $g \circ f \simeq \operatorname{id}_X$, we have $$ (g \circ f)_* = g_* \circ f_* = (\operatorname{id}_X)_* = \operatorname{id}_{\pi_1(X, x_0)}. $$
It follows that $f_*$, $g_*$ are inverses of each other. Hence they are isomorphisms, and $\pi_1(X, x_0)$, $\pi_1(Y, y_0)$ are isomorphic.