* The Earth's rotation: The reason we see the sun during the day and the moon at night is because the Earth rotates. As the Earth spins, different parts of the planet face the sun. When our side of the Earth faces the sun, it's daytime. When our side of the Earth faces away from the sun, it's nighttime.
* The moon's position: The moon orbits the Earth, and its position changes relative to the sun and Earth. Sometimes the moon is on the same side of the Earth as the sun, and sometimes it's on the opposite side.
* Lunar phases: The moon's phases (new moon, crescent, full moon, etc.) are determined by the angle at which we see the sunlit portion of the moon. During a new moon, the moon is between the Earth and the sun, making it invisible from Earth. This doesn't mean the sun is hiding behind the moon; it just means they are aligned in a way that we can't see the moon.
In summary, the sun doesn't "hide" behind the moon at night. The night sky is simply the side of the Earth that is facing away from the sun.