Plants obtain energy through a process called Photosynthesis, in which the plant takes the suns's energy through the Chlorophyll, which is what makes plants green, and uses it to make sugars out of the carbon dioxide from the air and water.
Hope this helps, and have a nice day!