What causes the earth to rotate?
Have you heard of Professor Kevin Luhman of Penn State University ? He makes this subject of Earth's rotation clear to everyone. He said "A fledgling star gathers a disk of dust and gas around itself. As things coalesce, the star's gravitational orbit sets that dust and gas to spinning.Any clump that forms within that disk is going to naturally have some sort of rotation,"
Now due to the conservation of angular momentum our earth has to keep on rotating even when there's no need to do it.
Moon also affects the rotation of the earth. Moon's pull slows the rate of rotation of the earth, Because of the Moon, the spin of the Earth is slowing down at a rate of about 1 millisecond per year
I hope it helps to a certain extent in understanding why our Earth rotates.