According to NASA, the phases of the moon are caused by the sunlight and shadow created by its relative position to the sun. At two points during the 29.5-day lunar cycle, the side of the moon facing the Earth is half in sunlight, half in shade. This creates a half moon, a phase that lasts a few days before it either fills to gibbous or shrinks to a waning crescent.
At any given point in time, half of the moon's surface is illuminated by the sun's light. When the illuminated side faces Earth in its entirety, the moon appears full. When the illuminated side faces away from the Earth, the moon is in its new phase. As the moon moves through space around the Earth and its position changes relative to the sun's light, the moon appears to change its phase, beginning as an illuminated crescent after a new moon, swelling to full, and then slowly waning back through a half-moon and waxing crescent before the darkness of the new moon.
In some cases, the Earth's own shadow can cause the face of the moon to change. When the moon and Earth are lined up with the sun, it can create a lunar eclipse. During these events, the Earth's shadow can partially obscure the lit side of the moon, creating a temporary half moon.