It takes about 29 days for the Moon to pass through all its phases. More precisely, the cycle from one new moon to the next averages about 29.53 days and is called a synodic month.
The Moon does not produce its own visible light; sunlight illuminates different portions of its surface as the Moon orbits Earth. From Earth, we see these changing fractions as the familiar phases: new moon, waxing crescent, first quarter, waxing gibbous, full moon, waning gibbous, last quarter, and waning crescent. The complete sequence then begins again.
A common mix-up is the Moon's orbital period relative to the stars. That sidereal month is about 27.3 days. The phase cycle is longer because Earth is also moving around the Sun, so the Moon must travel slightly farther before the same Sun-Earth-Moon alignment recurs. The Moon's orbit is also elliptical, so the exact interval varies somewhat from cycle to cycle.