The phases of the Moon are due to the movement of the Moon around the Earth. As the Moon revolves around the Earth different phases are seen. One important thing to note here is that for the phases to occur the Earth does not have to be in the path of the Moon and the Sun. That happens very rarely and only during lunar eclipses.
As the Moon revolves around the Earth, one half of the Moon is always illuminated by light from the Sun. But whether we see that side or not is dependent on the position of the Moon with respect to the Earth.
You can see more clearly in the link provided below the phases of the Moon and how they are dependent on where the Moon is. We see the Full Moon phase when the Moon is positioned such that we can the side that is illuminated by the Sun completely. On the other hand when the side of the Moon on which the Sun is shining is facing away from the Earth, we have the New Moon Phase. As the Moon revolves, intermediate stages between full moon phase and the no moon phase are seen.
The phases of the Moon change every day and a complete cycle takes approximately 29 and a half days.