Think of it like a mirror. When sunlight hits a mirror, it bounces back and we see that reflected light. The Moon acts in a similar way, reflecting the sunlight that hits its surface.
This is why we see different phases of the Moon. The amount of sunlight reflected towards Earth changes depending on the Moon's position relative to the Sun and Earth.