Everyday we go through day and night and many times think that why it happens.
This is because earth rotates on its own axis. This axis is an imaginary line that passes through the North Pole and South Pole of the earth. The sun is an enormous source of light and it does not move from its place as other planets revolve around the sun. It only seems that the sun is moving from east to west during the day but actually it is the earth that moves. So during the earthâ€™s rotation around its axis the part that faces the sun experience day and the part away from the sun experience night. In this way half of the earth always remains in darkness and half is always in sunlight. The time taken by the earth to complete its one rotation around its axis is 24 hours. We live on earth still we never feel the movement of earth because it is moving constantly and smoothly at the same speed. Our earth spins in counter clockwise direction when it is viewed from above the North Pole. The area of daylight always moves from east to west on the earth.
Other planets also spin on the axis including sun so they also have day and night but the length of it can differ from the planet to planet.