In a Nutshell : Earth rotates simply because it has not yet stopped moving!
The solar system, and indeed the galaxy, were formed by the condensation of a rotating mass of gas. Conservation of angular momentum meant that any bodies formed from the gas would themselves be rotating. As frictional and other forces in space are very small, rotating bodies, including Earth, slow only very gradually (see our article Will the Earth ever stop spinning?)
You may think that the moon has stopped rotating because it “appears” to keep the same face turned towards us. However you’d be wrong. The reason why it presents the same face to us is that its period of rotation is the same as its period of revolution around Earth. This equality is the result of tidal friction.
|Will the Earth ever stop spinning?|
|Why is there a dark side of the moon?|
|How Much is the Earth Affected by the Other Planets?|