Plants get carbon dioxide from the air that surrounds them. The carbon dioxide from air naturally diffuses through extremely small pores in the leaves of plants.
While the overall equation of photosynthesis has reactants of water, carbon dioxide and energy from sunlight to produce glucose and oxygen, there is more than one step. Light reactions occur in chloroplasts with water, to produce oxygen and usable energy in the forms of ATP and NADH. These two energy products are then used in the Calvin cycle, along with carbon dioxide, in order to produce glucose that can be used by the plant's cells as an energy source.