Everything in the universe is constantly moving. Matter from the big bang is still moving outward from the center of the universe.
Gases and materials spun off from the original explosion in eddies, like the whirlpools you can make in water by swirling your hand in a circle. Unless these celestial bodies are stopped, by crashing into another body, for instance, they continue to turn while they travel through space.
The same is true of Earth—it was rotating as it formed and has not stopped.