It's actually believed that chloroplasts and mitochondria used to be their own unique, single-celled organisms, which evolved to work symbiotically with the bigger, eukaryotic (more complex, with a true nucleus) cells that were beginning to develop and become more complex. The relationship made a lot of sense: the chloroplasts and mitochondria would get lots of free food from the host organism, and in exchange it would help make energy for its host through photosynthesis or respiration processes.
So those two organelles kept their DNA through today, because they're still kind of their own thing. That also leads to an interesting quirk: because a female's egg cells contain mitochondria but a male's sperm cells don't, all mitochondrial DNA is passed down from the mother - in other words, I have my mom's mitochondria, but not my dad's. This can be used to track descent down the female line.