Long ago there was only a single cell in the void of space
Then that cell EXPLODED
Over time universe cool to form the planets that are here today
During this time period there was only one cell. A bacteria cell.
Over that time period the earth cool and there was anaerobic and aerobic cells. As the two started two depend on each of them start to move closer and closer to form and new cell. This process is called endosymbiotic.
Those two cells was the mitochondria and the chloroplasts due to the evidence shown in Lynn Margulis studies she prove that the mitochondria and chloroplast was prokaryotes due to fact that they have double membranes. And that is the Endosymbiotic theory.