Years ago, our Solar System formed within a cloud of hydrogen.
Then, it took some kick, like from the shockwave from a nearby supernova, and this set a region of the cold gas falling inward through its mutual gravity. As it collapsed, the cloud began to spin. (Conservation of angular momentum.) As the Solar System spun more rapidly, it flattened out into a disk with a bulge in the middle. The Sun formed from the bulge at the center of this disk, and the planets formed further out. They inherited their rotation from the overall movement of the Solar System itself. Over the course of a few hundred million years, all of the material in the Solar System gathered together into planets, asteroids, moons and comets. Then the powerful radiation and solar winds from the young Sun cleared out everything that was left over. Without any unbalanced forces acting on them, the inertia of the Sun and the planets have kept them spinning for billions of years. And they?ll continue to do so until they collide with some object, billions or even trillions of years in the future. http://www.universetoday.com/14491/why-does-the-earth-rotate/