Since they cannot make their own food through photosynthesis, fungi obtain their food from their hosts as parasites, from dead organic matter as saprophytes, or as mutualistic symbionts (with algae, in the form of lichen).
Fungi, like bacteria, are the principal decomposers of the biosphere.
Lindemann J, Holtkamp E, & Herrmann R (1990) The impact of aluminium on green algae isolated from two hydrochemically different headwater streams, Bavaria, Germany.
Chiefly saprophytes in rich soil, decayingwood, etc.
This unique property of green plants -- the capacity to build up or synthesize the carbon contained in carbon-dioxide into organic materials and to incorporate these into their bodies, using for this purpose the energy provided by sunlight -- is known to science as photosynthesis; literally, building up by means of light.
In fungi, this remarkable food mechanism is lacking.
They may be parasites or saprophytes
There is, however, a very acute nitrogen problem, the solution of which for the ordinary green plant is closely bound up with the vital activities of various members of the soil population, among which may be reckoned the mycelium of many soil fungi.
Although roughly 75 per cent of the volume of the air we breathe consists of nitrogen in the gaseous form, this source of the element is useless for green plants, as it is indeed for all other living organisms except certain highly specialized bacteria, probably some species of fungi, and a few of the simplest green plants or algae.
some of which the algae use in the process of photosynthesis.
Some members of the last group like the Broomrape (Orobanche spp.) and Dodder (Cuscuta spp.) have become totally dependent, lacking green leaves or the capacity to form chlorophyll; sometimes, as in the case of the Dodder, lacking also the capacity to form roots and thereby severing all direct connection with the soil.
There is also a small and equally remarkable group of flowering plants, not apparently parasitic in habit, that have lost their power of forming chlorophyll and are often regarded as having become completely saprophytic in their mode of nutrition.
Manures & Fertilizers | Blue Green Algae | IndiaAgroNet
Whether, however, these plants, such as Indian Pipe (Monotropa Hypopitys), Bird's Nest orchid (Neottia nidus-avis), and other orchids of similar habit, are truly saprophytic and derive their food supplies directly from the fallen leaves and other organic detritus in which they commonly grow, or depend to a greater or less extent upon the activities of certain fungi invariably associated with their roots or other underground parts, is not at all certain.
Photosynthesis by blue-green algae
This escape of nitrogen from chemical combination by denitrification as it is called, is compensated by the reverse process described as fixation of nitrogen likewise dependent on the life activities of a group of organisms -- certain highly specialized bacteria, probably some species of fungi; and a few of the simpler green plants or algae that can utilize nitrogen gas as a source of food and build it up into the proteins of their bodies.