The original source of energy for all animals in a food web is the sun. Plants capture sunlight through photosynthesis, converting water and carbon dioxide into glucose and oxygen.
This glucose fuels plant growth and serves as the primary energy source for herbivores. Carnivores then obtain energy by eating herbivores, and the energy transfer continues up the food web. At every level, organisms rely on energy stored in the level below.
Ultimately, all energy in a food web can be traced back to the sun.