Earthworms "plow" and mix up the soil. Their tunneling loosens the soil so water and nutrients can go downward. The nutrients in worm castings enrich the soil. The slime they secrete contains nitrogen, an important nutrient for plants.
Worms help to increase the amount of air and water that gets into the soil. They break down organic matter, like leaves and grass into things that plants can use. When they eat, they leave behind castings that are a very valuable type of fertilizer. Earthworms are like free farm help.
Worms feed on plant debris (dead roots, leaves, grasses, manure) and soil.