Although mushrooms grow from the ground, they are not plants! Instead, mushrooms are a part of a completely different kingdom called fungi. Other examples of fungi are yeasts and molds. Fungi can be unicellular or multicellular, use spores to reproduce, are made of a mass (mycelium) of filaments called hyphae, contain chitin in their cell walls, and are heterotrophic.
The fact that fungi are heterotrophs is the point of interest in answering this question. Unlike producers that make their own food (such as plants), heterotrophs are consumers and must eat other things in order to survive. However, fungi are not like animals. They do not have digestive organs. Instead, fungi digest organisms outside of themselves. This is done by releasing digestive enzymes externally. These enzymes break down organic compounds in the ground. Once the organic material is decomposed, the fungi can absorb it using its hyphae.