Organelles like mitochondria and chloroplasts have their own DNA primarily because they used to be free-living prokaryotes that functioned as unicellular organisms. This is supported by the endosymbiotic theory, which suggests that these organelles originated from ancient prokaryotic cells that were engulfed by ancestral eukaryotic cells. Over time, these prokaryotes became integral parts of the eukaryotic cell, yet they retained some of their genetic material, which is why they have their own DNA today.
So, the best answer to your question is: 4. They used to be free-living prokaryotes that functioned as a unicellular organism.