A planetary nebula is the phase of a:
C. main sequence star late in its life.
Planetary nebulae typically form from the outer layers of a medium-sized star (like our Sun) being expelled when the star evolves away from the main sequence stage and becomes a red giant. This process occurs during the later stages of the star's life cycle, after it has exhausted the hydrogen in its core.