So since the planets all came from our flattened protoplanetary disc, they all ended up in the same plane, meaning the solar system is flat: it looks like a frisbee, instead of like a ball. Except they’re not exactly in the same plane, but they’re close. The drawing above shows the solar system as seen edge-on.
The plane of the Earth’s orbit is called the plane of the ecliptic (because eclipses happen in this plane). The plane of the ecliptic is 1.6 degrees off of the invariable plane, which is a sort of average orbital plane of the entire solar system. If they were exactly the same, it would be 0 degrees off.
The other planets are also fairly close to the invariable plane, with Mercury being the furthest off by far, at 6.3 degrees to the invariable plane. The drawing above is not to scale of course, but you can see how close to flat variations in degrees this small are. Asteroids, comets, and other objects do not adhere to the invariable plane like the planets do, however. 

So since the planets all came from our flattened protoplanetary disc, they all ended up in the same plane, meaning the solar system is flat: it looks like a frisbee, instead of like a ball. Except they’re not exactly in the same plane, but they’re close. The drawing above shows the solar system as seen edge-on.

The plane of the Earth’s orbit is called the plane of the ecliptic (because eclipses happen in this plane). The plane of the ecliptic is 1.6 degrees off of the invariable plane, which is a sort of average orbital plane of the entire solar system. If they were exactly the same, it would be 0 degrees off.

The other planets are also fairly close to the invariable plane, with Mercury being the furthest off by far, at 6.3 degrees to the invariable plane. The drawing above is not to scale of course, but you can see how close to flat variations in degrees this small are. Asteroids, comets, and other objects do not adhere to the invariable plane like the planets do, however. 

It is thought that solar systems form when part of a diffuse cloud of gas (mostly hydrogen and helium) begins to collapse due to its own gravity. This is called a pre-solar nebula. At the center, a star forms, and much of the remaining material ends up rotating around the star in a flattened disc. This so-called protoplanetary disc eventually agglomerates into orbiting planets, which build up from the material in the disc over time. 
Protoplanetary discs have been observed by astronomers around young stars close by. The sun, the Earth, and our fellow planets likely formed the same way. Nearly everything in our solar system turns in a counter clockwise motion, which means our protoplanetary disc and the nebula that lead to it must have been spinning this direction.
Why rotation at all? Anytime a lot of mass ends up in one place (the protostar), gravity there gets very strong. This pulls in the surrounding material (the disc). Anytime something spinning a little bit gets pulled in, it speeds up. (Watch a spinning ice skater pull their arms in—or try it in your desk chair!) So, the disc ends up rotating quite a bit. 

It is thought that solar systems form when part of a diffuse cloud of gas (mostly hydrogen and helium) begins to collapse due to its own gravity. This is called a pre-solar nebula. At the center, a star forms, and much of the remaining material ends up rotating around the star in a flattened disc. This so-called protoplanetary disc eventually agglomerates into orbiting planets, which build up from the material in the disc over time. 

Protoplanetary discs have been observed by astronomers around young stars close by. The sun, the Earth, and our fellow planets likely formed the same way. Nearly everything in our solar system turns in a counter clockwise motion, which means our protoplanetary disc and the nebula that lead to it must have been spinning this direction.

Why rotation at all? Anytime a lot of mass ends up in one place (the protostar), gravity there gets very strong. This pulls in the surrounding material (the disc). Anytime something spinning a little bit gets pulled in, it speeds up. (Watch a spinning ice skater pull their arms in—or try it in your desk chair!) So, the disc ends up rotating quite a bit.