Sorry to be late to the party, but here's an example of 2 compact simply connected manifolds which have the same homotopy groups, same homology groups, same cohomology ring, and yet are not homotopy equivalent. The examples are motivated by Grigory M's examples:$S^2\times S^2$ and $\mathbb{C}P^2\#\overline{\mathbb{C}P^2}$. His examples are both $S^2$ bundles over $S^2$.
If we extend this further, it turns out there are precisely two $S^3$ bundles over $S^2$. Of course, one is the product $S^3\times S^2$, while another doesn't have a more common name, so I'll just denote it $S^3\hat{\times} S^2$.
Both of these spaces are diffeomorphic to quotients of free linear $S^1$ actions on $S^3\times S^3$. Letting $X$ denote either bundle, we have a long exact sequence of homotopy groups $$...\pi_k(S^1)\rightarrow \pi_k(S^3\times S^3)\rightarrow \pi_k(X)\rightarrow \pi_{k-1}(S^1)\rightarrow ...$$
which can be used to show that $\pi_k(X) \cong \pi_k(S^3\times S^3)$ for $k\geq 2$ and $\pi_1(X) = \{e\}$ and $\pi_2(X) \cong \mathbb{Z}$.
The Hurewicz theorem together with Universal coefficients theorem implies $H^1(X) = 0$ and $H^2(X) \cong \mathbb{Z}$. Poincare duality then forces the rest of the cohomology rings to agree.
Finally, to see $S^3\times S^2$ and $S^3\hat{\times} S^2$ are different, one computes the Stiefel-Whitney classes of their tangent bundles. It turns out $w_2(S^3\times S^2) = 0$ while $w_2(S^3\hat{\times}S^2)\neq 0$. (And all other Stiefel-Whitney classes are $0$ for both spaces). Since the Stiefel-Whitney classes can be defined in terms of Steenrod powers, they are homotopy invariants, so $S^2\times S^3$ and $S^3\hat{\times}S^2$ are not homotopy equivalent.
You've shown that $f$, and hence $f \circ g$, has finite image. Can we use this fact alone to show what we want? Let $H\colon Y \times [0, 1] \to Y$ be a homotopy starting at $f \circ g$. Then for each $y \in Y$ the set $H(\{y\} \times [0, 1])$ is connected. What are the connected subsets of $Y$?
Best Answer
If you're allowed to do cohomology, note that $H^*(S^1 \vee S^2 \vee S^3)$ is isomorphic to the direct sum $H^*(S^1)\oplus H^*(S^2) \oplus H^*(S^3)$, so cup product of the generators of $H^1$ and $H^2$ is trivial. Whereas cup product of the generators of $H^1$ and $H^2$ is evidently nontrivial for $S^1 \times S^2$, by Kunneth formula if you wish.
Doing this with homology is a bit tricky: note that universal cover of $S^1 \vee S^2 \vee S^3$ is the topological space which looks like $\Bbb R$ with a copy of $S^2 \vee S^3$ attached to each integer point in $\Bbb R$. This is homotopy equivalent to an infinite wedge of $S^2 \vee S^3$'s, hence the homology group $H_3$ is nontrivial - in fact isomorphic to $\bigoplus \Bbb Z$
On the other universal cover of $S^1 \times S^2$ is $\Bbb R \times S^2$, which is homotopy equivalent to $S^2$. That has trivial homology on dimension $3$, so is not homotopy equivalent to the universal cover of $S^1 \vee S^2 \vee S^3$. Thus, $S^1 \times S^2$ is not homotopy equivalent to $S^1 \vee S^2 \vee S^3$ either.