Day and night are caused by the rotation of the Earth on its axis. The Earth rotates from west to east, which is why the Sun appears to rise in the east and set in the west. If we could view the Earth from above the north pole, we would see that it rotates counterclockwise, and we would watch daylight and darkness sweeping across the globe from east to west. When we are on the side of the Earth that is facing the Sun, we have daylight, and when we are on the side facing away from the Sun, we have nighttime. The Earth takes 24 hours to complete one rotation, which is why we have a 24-hour day.
All the planets in our solar system experience day and night cycles because they spin on their axes. However, there are differences in the length of day and night, and the cycles are made even more complex by the tilt of a planets axis and its rate of orbit. Some planets rotate faster than Earth, while others rotate slower.
In summary, the rotation of the Earth on its axis causes day and night. When we are on the side of the Earth facing the Sun, we have daylight, and when we are on the side facing away from the Sun, we have nighttime.