Is it true that two spaces or $\infty$-groupoids are homotopy equivalent if and only if they have isomorphic homotopy groups?
[Math] Homotopy equivalent iff isomorphic homotopy groups
homotopy-theory
Related Solutions
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.
Let $x_0 \in X$, then we can define the fundamental group of $X$ with basepoint $x_0$, written $\pi_1(X, x_0)$. If $x_1 \in X$, $\pi_1(X, x_1)$ and $\pi_1(X, x_0)$ may be different groups. However, if $x_0$ and $x_1$ lie in the same path-connected component of $X$, they are isomorphic. In particular, if $X$ is path-connected, the fundamental group of $X$ is independent of the choice of basepoint, so we can denote the fundamental group by $\pi_1(X)$. If $X$ is not path-connected, then $\pi_1(X, x_0) = \pi_1(C_{x_0}, x_0) = \pi_1(C_{x_0})$ where $C_{x_0}$ denotes the path-connected component of $X$ containing $x_0$. For example, $X = \{0\} \cup S^1 \subset \mathbb{C}$ has two path-connected components with different fundamental groups: $\pi_1(X, 0) = \pi_1(\{0\}, 0) = \pi_1(\{0\}) = 0$ and $\pi_1(X, 1) = \pi_1(S^1, 1) = \pi_1(S^1) \cong \mathbb{Z}$.
It follows that your question doesn't really make sense: what is the fundamental group of a space which is not path-connected? You need to choose a basepoint.
What you can say is the following: if $f : X \to Y$ is a homotopy equivalence, then for any $x_0 \in X$, $\pi_1(X, x_0) \cong \pi_1(Y, f(x_0))$. In particular, if $X$ and $Y$ are path-connected, $\pi_1(X) \cong \pi_1(Y)$.
Best Answer
It is not true in general: the simplest counterexample is given by $S^3\times\mathbb{RP}^2$ and $S^2\times\mathbb{RP}^3$. Their fundamental group is $\mathbb{Z}/2\mathbb{Z}$ and higher homotopy groups are isomorphic since both spaces have $S^2\times S^3$ as universal cover, however it is easily shown that they are not homotopy equivalent by computing for example $H_5(S^3\times\mathbb{RP}^2)=0$ and $H_5(S^2\times\mathbb{RP}^3)=\mathbb{Z}$ (or simply noticing that $S^2\times\mathbb{RP}^3$ is orientable while $S^3\times\mathbb{RP}^2$ is not).
Another example is given by the lens spaces $L(5,1)$ and $L(5,2)$ have isomorphic homotopy groups but are not homotopy equivalent.