The Earth spins on its axis and makes one complete turn every 24 hours. A way to think about this is with a flashlight and a basketball in an ark room. set up the flashlight in one position and then put the ball a few meters away... now as the ball spins on its axis (its NOT moving around the flash light, the ball is just rotating at a fixed position. You will see that in one revolution a fixed point on the ball is in the light half of the time. The other half the point is facing away from the sun and it is dark.
In the case of the earth, it takes 24 for the basketball to make one full spin.
We call one rotation the "length of the day". Today it is 24 hours. But it has not always been 24 hrs!!
Billions of years ago, the length of the day was about 12 hrs!!!!
The Earth is slowly de-spinning. That is the earth is gradually slowing down as far as spinning goes.
The reason why is because there is friction from the Moon and sun...this is called TIDAL friction. Millions of years from now the earth will permanently face the sun. That is the length of the year and the length of the day will be equal. This is called SYNCHRONOUS rotation.