The moon doesn't actually produce its own light. It reflects sunlight.
Think of it like a giant mirror in space. The sun shines on the moon, and the moon's surface bounces that light back towards us. That's why we see the moon glowing in the night sky.