The sun is the primary energy source for all of the Earth's lifeforms. Photosynthesis is a process where the energy of the sun converts carbon dioxide and water into glucose. This happens mostly in the leafs green plants. Chloroplasts in the leaf cells contain chlorophyll, which captures the energy of the sun and makes photosynthesis possible.
Chlorophyll captures light energy from the sun and converts it to electrical energy. The electrical energy splits apart carbon dioxide (coming through pores, called stomata, in the plant) and water (coming through the roots and stem) molecules in the plant. This can be expressed by the chemical equation:
6 CO2 + 6 H2O + light → C6H12O6 + 6 O2 Carbon Dioxide + Water + Light energy → Glucose + Oxygen
The oxygen is released into the air, where it can be inhaled by animals. Glucose is used by the plant for energy. It is called a carbohydrate.