The correct answer is: Ancient eukaryotic cells resembling archaeal cells first acquired symbiotic bacteria that eventually took up permanent residence to become mitochondria.
According to endosymbiotic theory mitochondria evolved from a small, autotrophic bacterium that was eaten (but not digested) by a heterotrophic simple eukaryotic cell. The relationship between two organisms became symbiotic (beneficial for both): eukaryotic cell provided protection and nutrients to the prokaryote, and in return, the prokaryotic cell provided energy through its respiratory cellular machinery (today we know it is electron transport chain). The relationship became permanent over time, they became dependent on each other.
Origin of chloroplast is similar: eukaryotic cell with mitochondria engulfed a photosynthetic cyanobacteruim.