A food web is a comprehensive map of how energy moves, in the form of food, throughout an ecosystem, while a food chain is one specific path through the web. Most food webs on Earth derive their energy primarily, if not exclusively, from sunlight. That energy is captured by plants via photosynthesis and then distributed to the consumers in the environment.
A food web describes the many diverse routes energy can take as it passes through an ecosystem. A single food chain might begin with a producer, such as grass, using sunlight to grow and synthesize sugars and proteins. That grass might then be eaten by a grasshopper, which is then classed as a primary consumer. In this chain, the grasshopper is then eaten by a secondary consumer, such as a lizard, which is then eaten by a bird.
An alternate chain might have the grasshopper being eaten by a small bird, which is then eaten by a mammal. The sum of all of the potential food chains in an ecosystem, if mapped out in detail, forms a complex web that charts the potential distribution of energy up and down among the consumers in the environment. Both food chains and food webs are useful in a detailed study of ecology.