see url At the beginning of the universe, there were only gas and dust particles in space. since objects with physical mass have a mutual attraction, the dust particle agglomerated gradually to form larger bodies such as stars and planets. These bodies started rotating the moment they collided. After many collisions, the rotations got added up. For this reasons, the planets, including the Earth, are in a constant state of motion in their respective orbits.