The most accurate and comprehensive answer to why organelles like mitochondria and chloroplasts have their own DNA is:
They used to be free-living prokaryotes that functioned as unicellular organisms.
This statement reflects the endosymbiotic theory, which suggests that mitochondria and chloroplasts originated from free-living prokaryotes that were engulfed by an ancestral eukaryotic cell. Over time, these prokaryotes and their hosts formed a symbiotic relationship, leading to the retention of their own DNA, which is necessary for their specific functions and replication within the eukaryotic cell.
While it is also true that DNA is used to code for proteins (first option) and that these organelles are involved in their own replication (fourth option), the key reason for the presence of their own DNA is their evolutionary history as once-independent organisms. The third option is not accurate, as not all organelles have their own DNA—many do not.