Plants make food by a process known as photosynthesis. As the name suggests, photo or light energy is used in this process of synthesis. Plants use three ingredients: sun light, carbon dioxide (CO2) and water (H2O) to make food (sugars). The following takes place during photosynthesis:
`6CO_2 + 6H_2O + (light) -> C_6H_(12)O_6 + 6)_2`
Another useful product (apart from sugar) is the oxygen, which maintains the oxygen concentration in our atmosphere and enables life sustenance on this planet. The process also removes excess carbon dioxide from our atmosphere, again helping our survival. Photosynthesis is opposite of our respiration. We consume oxygen, break down sugar and generate carbon dioxide; plants consume carbon dioxide and generate oxygen and food. We are thus dependent on photosynthesis for our survival.
Note that photosynthesis takes place in plants containing chlorophyll.
Hope this helps.