Endosymbiotic theory, is an evolutionary theory which explains the origin of eukaryotic cells from prokaryotes.
Key organelles of eukaryotes originated as symbiosis between separate single-celled organisms.
According to this theory, mitochondria and chloroplasts are descendants of formerly free-living bacteria.
These bacteria were taken inside another cell as an endosymbiont, and over time lost their ability to live on their own, but gained a stable protective environment.
Would have occured around 1.5 billion years ago.
Uprooting the Tree of Life