Mitochondria and chloroplasts are organelles found in eukaryotic organisms (e.g. organisms with a nucleus). Mitochondria and chloroplasts do the same job -- they process energy for the cell -- but they do it in completely different ways. Mitochondria process energy in a cycle called cellular respiration, while chloroplasts harvest energy from light in a process called photosynthesis. Despite their functional differences, there is a similarity in the structure of these two organelles, which stems from their evolutionary origins in a process known as endosymbiosis.
The primary purpose of mitochondria in a eukaryotic organism is to supply energy for the rest of the cell. The mitochondria are where most of the cell's adenosine triphosphate (ATP) molecules are produced, through a process called cellular respiration. Production of ATP through this process requires a food source (either produced via photosynthesis in photoautotrophic organisms or ingested exteriorly in heterotrophs). Cells vary in the amount of mitochondria that they have; the average animal cell has more than 1,000 of them.
Chloroplasts are where photosynthesis occurs in photoautotrophic organisms like plants. Within the chloroplast is chlorophyll, which captures sunlight. Then, the light energy is used to combine water and carbon dioxide, converting the light energy into glucose, which is then used by the mitochondria to make ATP molecules. The chlorophyll in the chloroplast is what gives plants their green color.
The most obvious similarity between mitochondria and chloroplasts is that they are involved in fueling the cell because they both convert energy from outside the cell into a form that is usable by the cell. Another similarity is that both mitochondria and chloroplasts contain some amount of DNA (though most DNA is found in the cell's nucleus). Importantly, the DNA in mitochondria and chloroplasts is not the same as the DNA in the nucleus, and the DNA in the mitochondria and chloroplasts is circular in shape. That's also the shape of DNA in prokaryotes (single-celled organisms without a nucleus). The DNA in the nucleus of a eukaryote is coiled up in the form of chromosomes.
The similar DNA structure in mitochondria and chloroplasts is explained by the theory of endosymbiosis, which was originally proposed by Lynn Margulis in her 1970 work "The Origin of Eukaryotic Cells." According to Margulis's theory, the eukaryotic cell came from the joining of symbiotic prokaryotes. Essentially, a large cell and a smaller, specialized cell joined together and eventually evolved into one cell, with the smaller cells, protected inside the larger cells, providing the advantage of increased energy for both. Those smaller cells are today's mitochondria and chloroplasts. This theory explains why the mitochondria and chloroplasts still have their own independent DNA: they are remnants of what used to be individual organisms.