A mitochondrion (seen through a microscope)
About two billion years ago, when there were only prokaryotic cells on Earth, mitochondria probably started out as independent cells that were especially good at digesting food. These cells were extra good at digesting because they had evolved to have two membranes, and the inside membrane, instead of just forming a circle or an oval, went back and forth in a much more complicated shape, as you can see here in the picture (all those thin lines across the mitochondrion are the inner membrane). A mitochondrion is between 1 and 10 micrometers long.
Mitochondria were also especially good at digesting because their DNA produced special enzymes that were able to use oxygen to break down the sugars that the cell eats in order to make energy for the cell. At this time oxygen, produced by photosynthesis, had just recently appeared in Earth's air in large amounts. Using oxygen to break down the food molecules releases about thirteen times as much energy as when the cell digests food without using oxygen, and that's a big advantage for any cell. Mitochondria take in hydrocarbon molecules and oxygen and put out carbon dioxide and water and energy.
When other prokaryote cells ate the mitochondria, some of them happened to leave the mitochondria alive inside them instead of killing them. This turned out to be useful for the bigger cell. The mitochondria could digest food for the bigger cell and provide energy. Eventually many mitochondria began living inside larger cells, which we call eukaryotes, and the mitochondria gradually lost the ability to live on their own. You could think of this as cooperation between two cells, or you could think of the mitochondria as tiny little slaves.
Mitochondria, though, like other slaves, are still basically looking out for their own interests, and not yours. They still have their own DNA and reproduce themselves. They don't even know that they live inside a big living creature, and they don't care. Your cells are just a nice place to live that has a lot of food. They just hang out inside cells - inside your cells! - waiting for the lysosomes to send them some food, and digesting it, and spitting out energy. When there's more food available, they reproduce faster, so that some cells that need to digest a lot of food because they use a lot of energy, like muscle cells, have thousands of mitochondria inside them. But the bigger cell is still in charge. If there get to be too many mitochondria in a cell, those same lysosomes can surround the mitochondria, break them into pieces, and recycle their proteins and lipids to make new cell parts.
To find out more about cells, check out these books from Amazon.com or from your library: