The origin of the germline-soma distinction is a fundamental unsolved question. Plants and basal metazoans do not have a germline but generate gametes from somatic tissues (somatic gametogenesis), whereas most bilaterians sequester a germline. We develop an evolutionary model which shows that selection for mitochondrial quality drives germline evolution. In organisms with low mitochondrial mutation rates, segregation of mutations over multiple cell divisions generates variation, allowing selection to optimize gamete quality through somatic gametogenesis. Higher mutation rates promote early germline sequestration. Oogamy reduces mitochondrial segregation in early development, improving adult fitness by restricting variation between tissues, but also limiting variation between early-sequestered oocytes, undermining gamete quality. Oocyte variation is restored through proliferation and random culling (atresia) of precursor cells. We predict a novel pathway from basal metazoans lacking a germline to active bilaterians with early sequestration of large oocytes subject to atresia, allowing the emergence of complex developmental processes.