It is a very complicated process. We don't really understand it all and if we did we could solve a lot of the worlds problems by efficiently turning light into food/energy for our own use.
What we do know is that plants take in carbon dioxide (CO2 gas), which is what people and animals breathe out and combine that with sunlight to make food. The food they make is a type of starch called glucose, similar to the bread we eat, but in a form more useful for plants.
The process is called photosynthesis and the substance that can do this amazing conversion is located in the plant leaves as chlorophyll. A very important side benefit is that when plants make food and store it for later use, they also give off oxygen as waste, which is what we need to breathe. Without plants we could not exist. Likewise, without people and animals giving off carbon dioxide as gas, plants could not survive, which makes it a very important relationship.
If you look at a huge redwood tree, it is hard to believe that it all came from sunlight. However, it is the carbon in the carbon dioxide gas that gets rearranged to make the wood and all the plant structures. Plants use photosynthesis to make food/energy and also for building material they need to grow.
Photons of light hit special chemicals in the plant chloroplasts causing an enzyme to break apart water. If we could figure out how to break apart water using only the sun it would solve all our energy problems. When the water breaks apart if make they later join back together with carbon dioxide to form glucose, which is their food.