Mitochondria and chloroplasts
arose independently about 2 billion years ago by endosymbiosis when
free-living prokaryotes were engulfed
by primitive eukaryotic cells.
The engulfed cells specialized in aerobic respiration and
photosynthesis, respectively,
and developed a mutually beneficial relationship with their host.