Our Solar System formed about 4.6 billion years ago when a huge cloud of gas and dust started to collapse under its own gravity.
As the cloud collapsed, it started to spin. Some of the material within this cloud gathered into swirling eddies and eventually formed into planets. As the planets formed, they kept this spinning motion. This is similar to what you see when skaters pull in their arms and spin faster. As material gathered in more closely to form a planet, like Earth, the material spun faster.
Why does the Earth still Spin?
To put it bluntly, the earth is still spinning because there are no forces acting to make it stop spinning! This is known as Inertia – an inherent law of nature.
Inertia is the tendency of an object to remain in motion unless and until acted upon by an unbalanced force.