This result was proved by J. H. C. Whitehead in two landmark papers from 1949, and provides a justification for working with the concept of a CW complex that he introduced there.
A map f is a weak homotopy equivalence if the function is bijective, and the homomorphisms
between simply connected CW complexes that induces an isomorphism on all integral homology groups is a homotopy equivalence.
On the other hand their homology groups are different (as can be seen from the Künneth formula); thus, X and Y are not homotopy equivalent.
The Whitehead theorem does not hold for general topological spaces or even for all subspaces of Rn.