This question already has an answer here:
Why do all of the planets in our solar system move is (more or less) the same plane? It would seem that the planets should all have very different orbital planes, each at a different angel to each other. The fact that all of their orbits are so closely parallel suggests that a force is pulling and/or maintaining the orbits of the planets in a flat plane. What is that force? A similar force also seems to be working at a galactic level too.