What exactly is a day?
How many days are in a year? 365.
How many times does the earth rotate on its axis in a year? 366.
If you think a day is the time it takes for earth to rotate once around its axis, you're approximately right, but off by about four minutes.
What we typically mean by "day" is the time it takes for earth to return to the same position relative to the sun, i.e. the time from one noon to the next. But because the earth is orbiting the sun as well as rotating on its axis, it has to complete a little more than one rotation around its axis to bring the sun back to the same position.
Since there are approximately 360 days in a year, the earth has to rotate about 361 degrees to bring the sun back into the same position. This extra rotation takes 1/360th of a day, or about 4 minutes. (We'll be more precise below.)
Here's another way to see that the number of rotations has to be more than the number days in a year. To make the numbers simple, assume there are 360 days in a year. Suppose you're looking up at the noon sun one day. Next suppose it is exactly 180 days later and the earth had rotated 180 times. Because the earth is on the opposite side of the sun, you would be on the opposite side of the sun too. For it to be noon again 180 days later, the earth would have to have made 180.5 rotations, making 361 rotations in a 360-day year.
Sidereal daysImagine an observer looking straight down at the Earth's north pole from several light years away. Imagine also an arrow from the center of the Earth to a fixed point on the equator. The time it takes for the observer to see that arrow return to same angle is a sidereal day. The time it takes for that arrow to go from pointing at the sun to pointing at the sun again is a solar day, which is about four minutes longer [1].
If you assume a year has 365.25 (solar) days, but also assume Earth is in a circular orbit around the sun, you'll calculate a sidereal day to be about 3 minutes and 57 seconds shorter than a solar day. Taking the elliptical shape of Earth's orbit into account takes about a second off that amount.
Related posts- Latitude doesn't exactly mean what I thought
- What is the shape of the earth?
- Mercury and the bandwagon effect
[1] Technically this is an apparent solar day, a solar day from the perspective of an observer. The length of an apparent solar day varies through the year, but we won't go into that here.