We wouldn't have mitochondria or chloroplasts (OK, plants wouldn't have chloroplasts) without some serious evolution resulting in endosymbiosis. Endosymbiosis is a term for when one organism lives inside another one, and it is a mutually beneficial relationship. Consider the role of a parasite living inside another organism and you see why that last part is important.
Eukaryotic cells came about through endosymbiosis and evolution. Once upon a time, all cells were prokaryotic and were pretty simple—no membrane-bound nucleus, no mitochondria or chloroplasts, and simpler DNA.
At some point long ago in evolutionary history, some prokaryotes started living inside of other, larger prokaryotes. This probably happened when the larger cell tried to eat the smaller organism and it didn't die. Over many generations, this emerged as a mutually beneficial relationship to the point where neither organism could live without the other. The smaller organism became a mitochondrion, and today mitochondria exist in all eukaryotic cells.
Endosymbiosis happened something like this:
The same process happened with chloroplasts, which are the organelles responsible for photosynthesis. Obviously not all cells have chloroplasts, or else humans and other animals would have much greener skin. Because mitochondria are present in all eukaryotes, and chloroplasts are only present in some, we can deduce that the evolution of chloroplasts happened after the evolution of mitochondria.
How do we know mitochondria and chloroplasts evolved this way? A few ways: first, both mitochondria and chloroplasts have their own circular DNA. Prokaryotes typically have circular DNA genomes, unlike the linear chromosomes found in eukaryotes. This supports the idea that the ancestors of both organelles were free-living prokaryotes that were engulfed by another organism.
Second, mitochondrial DNA is similar to DNA of some bacteria (the alpha proteobacteria, in case you were wondering). Coincidence? Unlikely. The best explanation is that mitochondria and protobacteria share a common ancestor. Similarly, chloroplasts and cyanobacteria share a common ancestor.
Third, mitochondria and chloroplasts have inner membranes with transport systems that are similar to the transport systems found in some prokaryotes.
Fourth, other symbioses exist on Earth these days, so we know that two organisms can live together and depend on each other. All the E. coli in our guts, for example, help our digestive system in exchange for a free place to live.
Early organisms in the history of life on Earth probably used glycolysis as their main form of energy production, and it has been handed down to all of the descendants of those early life forms. In the early days of life on Earth, the atmosphere did not have a lot of oxygen, so it makes sense that cellular metabolism did not require oxygen.
The citric acid cycle and oxidative phosphorylation could not have evolved before mitochondria were established, which was close to 2 billion years after prokaryotic cells arose. So even though we like to think of ourselves and human society as pretty advanced, we still use the ancient process of glycolysis in our cells.