As a kind of aside to this question, where one of the answers assumed that if $S^n=X \times Y$ then we can assume that $X$ and $Y$ are manifolds.
If we have a manifold $M$, such that $M$ is homeomorphic to $X \times Y$, then must $X$ and $Y$ be manifolds? The converse ($X,Y$ manifolds implies $X \times Y$ is a manifold) is certainly true. I’d like to think it is true, but I have seen enough strange topological behaviour to suggest this may not be true.
For this question take ‘manifold’ to mean a second countable Hausdorff space that is locally homeomorphic to $\mathbb{R}^n$, for some finite $n$.
Disclaimer: I’m by no means knowledgeable in this field and I haven’t read the papers or books I mention below. I found these by digging in the literature and hope these pointers are useful.
The answer to your question is no.
The first example was given by R.H. Bing, The Cartesian Product of a Certain Nonmanifold and a Line is $E^4$, Ann. of Math. (2) 70 (1959) 399–412. MR107228.
Bing describes a topological space $B$ — in fact a quotient space of $\mathbb{R}^3$, sometimes called the Dogbone space — which is not a manifold and has the property that $B \times \mathbb{R}$ is homeomorphic to $\mathbb{R}^4$.
Modifying this construction and relying heavily on work of Andrews and Curtis, K.W. Kwun, Product of Euclidean Spaces Modulo an Arc,
Ann. of Math. (2) 79 (1964) 104–108, MR159312, produced product decompositions of $\mathbb{R}^n \cong X \times Y$ for $n \geq 6$ where neither $X$ nor $Y$ is a manifold.
Here are two freely available papers by A.J. Boals:
Non-manifold factors of Euclidean spaces, Fund. Math. 68 (1970), 159–177, MR275396 in which he describes classes $\Gamma_{m}$ and $\Gamma_{n}$ with the property that for any spaces $X \in \Gamma_{m}$ and $Y \in \Gamma_{n}$ we have $X \times Y \cong \mathbb{R}^{n+m}$.
Factors of $E^{n+3}$ with infinitely many bad points, Fund. Math. 73 (1972), 95–99, MR319201.
Quoting C.D. Bass, Some products of topological spaces wich are manifolds, Proc. Amer. Math. Soc. 81 (1981), 641–646, MR601746, Corollary 3 on page 645 “gives abundant examples of factorizations of certain manifolds into nonmanifold factors.”
A textbook covering these and many more topics:
Daverman, Robert J., Decompositions of manifolds,
Pure and Applied Mathematics, 124, Academic Press, 1986, MR872468. (Reprinted by the AMS, 2007).
Here are two related MO-threads:
Is $\mathbb R^3$ the square of some topological space? (Richard Dore)
Square roots of $\mathbb R^{2n}$ (Mariano Suárez-Alvarez)
Added: A further MO-thread was posted and answered a couple of hours ago: