You can divide organisms into two broad classes depending on how they get their food. Like plants, autotrophs make their own food by harnessing energy from sunlight or chemical reactions, whereas heterotrophs like cows get their energy from other organisms. Lichen, however, are a little unusual because they're actually a partnership between two different organisms -- a heterotroph and an autotroph.
Lichen are not single organisms, so they cannot be simply classified as either an autotroph or a heterotroph. Lichen are actually formed from a multicellular fungus whose filaments or hyphae enclose either algae or cyanobacteria. The fungus protects the single-celled algae or cyanobacteria from strong sunlight and dry conditions. Without the fungus, the algae or cyanobacteria would be unable to survive on the dry, windswept rocks where lichen often thrive. When water does become available, the fungus absorbs it quickly, then only dries out slowly, enabling the algae and cyanobacteria wrapped up in its filaments to remain moist and active for as long as possible.
Algae and cyanobacteria are photosynthetic, meaning they use sunlight to make sugars from carbon dioxide in the air. In other words, they are autotrophs that make their own food. The fungi, by contrast, are heterotrophs that depend on sugars they receive from the algae or cyanobacteria. The symbiotic partnership between fungus and algae is beneficial to both parties -- the algae or cyanobacteria earn protection and provide food to their protector in return.
Lichen partnerships that involve cyanobacteria are special in some interesting ways. In addition to energy in the form of sugar, fungi also need nutrients and especially nitrogen in the form of amino acids. Nitrogen gas is abundant in the atmosphere but useless to the fungi until it's converted to a usable form. Cyanobacteria "fix" atmospheric nitrogen or use it to manufacture amino acids both for their own use and for the fungi that protect them. Lichen are also highly adept at soaking up nutrients even when those nutrients are present at very low concentrations.
A lichen cannot be classified as an autotroph because it's not a single organism. In effect, though, it acts like an autotroph because it makes its own food and is not dependent on other organisms. In fact, various heterotrophs get the energy they need by munching on lichen. Reindeer and caribou in northern North America, for example, eat lichen during the winter when vegetation is scarce. Their ability to colonize even the most inhospitable habitats ensures that lichen play an important role as pioneers, preparing barren, rocky areas for later plant growth.