The original prokaryotic autotrophic and heterotrophic cells on early Earth were absorbed by other cells which became internal structures or organelles and evolved into first eukaryotic cells.
The mitochondria and chloroplasts have DNA inside them and also have membrane bound organelles. This identifies that the organelles must have come from pre-existing cells with nucleic acid and a phospholipid bilayer.
The photosynthetic material inside the prokaryotic autotrophic cell gave the chloroplast the function of a photosynthetic organelle.
The material inside the prokaryotic heterotrophic cell, gave the mitochondria the function of a aerobic respiration.