The carbon that plants need for photosynthesis comes from carbon dioxide, or CO2 that's present in our atmosphere. Carbon dioxide is released into the air by organisms, such as animals that undergo cellular respiration. In other words, we breathe out CO2 as a waste product. A large amount of carbon dioxide in the air also comes from the oceans and from the burning of fossil fuels.
Plants take in that carbon dioxide from the air, and take in water (H2O) as well. Photosynthesis produces a chemical reaction that creates glucose, or C6H12O6, out of CO2 and H2O. This is a life-giving process, as the sun's energy is stored within the glucose, and oxygen is released from plants during this reaction.