Fungi absorb nutrients from living or dead organic matter (plant or animal stuff) that they grow on. They absorb simple, easily dissolved nutrients, such as sugars, through their cell walls. They give off special digestive enzymes to break down complex nutrients into simpler forms that they can absorb.
Most fungi can best be described as grazers, but a few are active hunters.
Hunter fungi prey on tiny protozoa and worm-like creatures called nematodes.
Some produce a sticky substance on their hyphae, which then act like flypaper, trapping passing prey.
A species called Arthrobotrys dactyloides sets snares made out of loops formed by its hyphae. When a nematode comes into contact with the loops, the movement triggers the fungal cells to swell with fluid, constricting the loop like a noose around the hapless nematode. Other hyphae then grow toward the trapped prey, eventually punching through its body where they begin absorbing its fluids.
Other fungi broker deals to get other creatures to feed them. For example, mycorrhizae have gone into partnership with many species of plants. The plants provide the fungi desirable nutrients such as carbons and a comfortable, safe home in their roots. The fungi in turn help the plants absorb essential nutrients, such as phosphorous. They also help the plants concentrate metals and other substances, making them useful in bioremediation.
Lichens partner with green algae or cyanobacteria to enable the organisms to grow in places that neither the fungi nor the algae or cyanobacteria could grow independently. The photosynthetic algae or bacteria churn out nutrients in the form of carbons, which are eaten by the fungal cells. In return, the fungi anchor the lichen community and protect the algae or bacteria.