Why does the Earth rotate?

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 particles 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 reason, the planets, including the Earth, are in a constant state of motion in their respective orbits.