Definition of weak homotopy equivalence Recall a weak homotopy equivalence is a continuous map $f:X_1 \rightarrow X_2$ that induces a bijection $f_*:[Y,X_1] \rightarrow [Y,X_2]$ for any CW-complex $Y$, where $[Y,X]$ denotes the homotopy class of continuous maps $Y \rightarrow X$. When $Y$ is restricted to be $\Bbb{S}^n$, this results in a series of isomorphisms between $\pi_n(X_1)$ and $\pi_n(X_2)$, and by Whitehead theorem it automatically becomes a homotopy equivalence when $X_i$'s are CW-complexes.
Why don't we define it in a similar way as homotopy equivalence, namely $(f_*)^{-1}:[Y,X_2] \rightarrow [Y,X_1]$ is induced by another continuous map $g:X_2 \rightarrow X_1$? Does the latter one necessarily implies homotopy equivalence? What will the difference of the two definitions change if we restrict $Y$ to be $\Bbb{S}^n$?

The reason why the definition of weak homotopy equivalence is good is because of Whitehead's theorem. It is the weakest definition (meaning the easiest to check) that is equivalent to homotopy equivalence for CW complexes, so you would not want to change it.
As to your new question, the Hawaiian earring is a counter example. There is a map $X \rightarrow H$ that is a weak homotopy equivalence from a cw complex to $H$, but there can be no inverse that you ask for because the fundamental group of $H$ has nontrivial topology while the fundamental group of $X$ is discrete (as it is for any CW complex).
