Chloroplasts (seen through a microscope)
Photosynthesis is the way some Cells on Earth pull in light from the Sun and use it to make energy to repair and reproduce themselves. The first cells could not photosynthesize (foe-toe-SIN-the-size). They got food by breaking apart hydrocarbon molecules.
But a little more than three billion years ago, some of the prokaryote cells evolved to be able to pull electrons out of the sunlight that fell on them from space. This turned out to be a very efficient method of getting food for the cell, and so more of the cells that lived this way survived. Pretty soon most of the cells on Earth got their food through photosynthesis.
When sunlight reaches the Earth, these cells mix the sunlight with molecules of carbon dioxide and water. The cells store the energy from the sunlight in bigger molecules made of carbon and oxygen atoms (from the carbon dioxide) and hydrogen atoms (from the water).
The photosynthesis process ends up with some oxygen left over, which the cell doesn't need and shoots back out of the cell. The early photosynthesizing cells took in so much carbon dioxide and shot out so much oxygen that by 2.2 billion years ago, Earth's atmosphere had a lot of oxygen in it - instead of 1% oxygen, Earth's atmosphere went up to about 20% oxygen, as it is now (20 out of every 100 atoms in the air are oxygen). People call this the oxygen revolution.
At first, only the blue-green prokaryotes could photosynthesize. But when other cells ate the blue-green prokaryotes, they found out that it was more useful to let the blue-green prokaryotes live inside them and keep making energy from sunlight, than it was to destroy them. Gradually more and more cells began to have lots of blue-green prokaryotes living inside them, and by about two billion years ago some of these blue-green prokaryotes lost the ability to live on their own and evolved into chloroplasts (KLOR-oh-plasts) that could only live inside other cells (This is very much like what happened to mitochondria about the same time.).