Photosynthesis is a chemical process carried out by most plants in order to store energy as food. Although plants are famous for this, there are also some fungi, bacteria and prostists which are also capable of this process.
First of all, let's start with the obvious. Organisms that carry out photosynthesis are green. This is because some of their cells (such as cells in a tree's leaves) have special organelles called chloroplasts. These chloroplasts contain a pigment called chlorophyll that absorbs light in order to use it to make food. However, these pigments do not absorb green light. This green light is reflected back and is why these structures appear to be green.
Each chloroplast (the organelles found in leaf cells) contain many smaller parts called thylakoids. It is inside these microscopic "poker-chip" shaped structures that photosynthesis takes place.
Here is the magic formula that makes photosynthesis work:
Carbon dioxide + Water + light energy = Sugar + Oxygen
For those of you who prefer the chemical formula version, here you go:
CO2 + H2O + light energy = C6H12O6 + O2
It is by this process that plants take in carbon dioxide from our atmosphere and produce oxygen. This formula is actually the exact opposite that we, and other animals, do. Plants take carbon dioxide and energy from the environment and produce sugar and oxygen. Yet we burn this sugar and take in oxygen in order to produce carbon dioxide and produce the energy we need to move around and live our lives.
So now let's get into the tricky details of it.
How does the carbon dioxide get into the leaves?
The outer layer of leaves (called the epidermis) have special cells called "Guard Cells". And these cells do exactly what their name implies: they guard the leaf. They are basically a gate which can open or close to let gas in and out of the leaf. However, when these guard cells open, water vapor often escapes. Because of this, if a plant is in a very dry environment, the guard cells will stay closed in order to prevent water loss. Although this may seem good, by closing those cells, they are also preventing carbon dioxide from entering the leaf which, in turn, stops photosynthesis dead in its tracks. This is why it's important for plants to live in fairly damp environments.
There is a second process, after the light reaction, that is required for photosynthesis to make sugar. This is known as the Calvin Cycle. This is the part of photosynthesis where the carbon dioxide comes into play. It is combined with the ATP molecule and NADPH molecule (both of which are formed by the light reaction in the thylakoid) which ultimately form a sugar molecule. Photosynthesis is a fairly complicated process, but that is a brief summary of this absolutely essential process.