Why do planets rotate and revolve in the universe?
As the planets evolve during their protoplanetary stage and accrete materials from the protoplanetary disks, which are gravitationally collapsing interstellar dust and gases, these accreted particles retain some of the angular momentum from the materials they form from and being in constant motion.
Generated image (virtual fly-by) from a simulation of the accretion period of the protoplanetary disk, showing preservation of
One nice description for this angular momentum preservation, and why the planets appear to rotate faster than their surrounding protoplanetary disk goes like this:
So it could be described as this axial rotation of planets resulting in conservation of the angular momentum of the materials in the protoplanetary disk, forming during the accretion period of the planetary system as the protoplanets gain in weight, and preserve this angular momentum due to inertia of their radial velocity.
The disk flattens from a 3d cloud to a 2d disk. A ring forms from a disk over-density band, reducing to a nominally 1d ring from a 2d band. The ring particles fall towards each other around the ring, and such attractions cause the ring to contract its circumference. The ring thus migrates inwards from the disk to the sun.
Ring particles collide and the average particle size increases while the number of particles decreases. The angular momentum of the ring increases as particles falling against the direction of spin of the ring fall inward from the circumference while the particles falling with the direction of spin fall outwards, so that mutual gravitational attraction of particles causes them to orbit one another rather than collide. This effect converts spin of the ring to spin of mutually bound particles within the ring.
Finally the ring collapses to one remaining particle which is the planet hatched by the ring. Moons are remaining large particles in the ring distant from the planet. Once the planet has formed and any remaining moons have bound themselves the planet, the ring no longer exists, leaving a planet and its moons if any in a stable orbit around the sun. Later other planets form from other over-dense bands of the disk.