What are various theories regarding the formation of Earth?
Clouds of gas and debris which exist in space have centers of gravity which cause the debris field to collapse toward a central point. This process is known as planetary accretion. As the field collapses angular momentum is conserved and primary rotation(s) begin. The solar system as well as the planets all rotate due to conservation of angular momentum around various gravitational centers.