Mushrooms are the fruits (fruiting body) of the fungus (just like apples are the fruits of the apple trees). They contain the spores from which future mushrooms will be born. They typically have a stem, a cap and a gill (or spores) under the cap, though there are mushrooms which might not stem or cap or gills.
We see only the fruit -- the mushroom -- but we do not see the vegetative body of the fungus. This vegetative body is known as mycelium and looks like a large of mat of fine threads or spider web. While digging soil, if you ever come across a thin whitish filament like structure, then that is a mycelium. The mycelium can be a small structure; or it can stretch into miles. The largest mycelium or fungus, in the world, is found in Oregon -- it covers an area of 2400 acres before a road cut through it.
You should be happy if you see mushroom growing in your garden. Unless you have pets (cats/dogs) which graze in the garden or toddlers who pick things up and put them in their mouth, do not destroy the mushroom. Sign of mushroom means you have a very healthy soil in which trees and plants can easily root and grow without any care. Fungi play an integral part in nature. They break down complex organic compounds of fats, carbohydrates and proteins into the most basic elements that can be used and absorbed by other organisms (for gardeners, it's the plants and trees). Plants and trees have symbiotic relation with fungi; the roots of plants and trees cannot directly absorb the nutrients as those molecules are large and complex to be absorbed. The fungus break those nutrients into simpler and tiny elements; the roots then absorb those nutrients, convert part of it in sugar and put back the sugar into the fungus. The fungus then thrive on those sugar.
Many scientists believe that fungi are responsible for creating forest and old growth. Fungus appeared on earth about 1500 million years ago, much before any land-plant appeared (land plants appeared about 700 million years ago). Fungi not only break up complex molecules but they also secret acidic and other substance which slowly breaks up rocks and stones into soil (we all know and have seen mushrooms forming on woods and slowly that wood will be broken up to become compost). Over years, the action of fungus turn that soil into rich humus-filled, matted soil on which large trees grow and spread, thus creating the old-growth forest. Scientists also believe that fungi and trees are responsible for the evolution of life form on earth. Fungus came; created soil on which plants evolved. As more plants evolved, spread and covered the earth, carbon-dioxide content in the atmosphere decreased; at the same time oxygen content increased. This created a perfect atmosphere for the appearance of other animals. In fact so much different varieties of animals appeared in about 530 million years ago that scientists call that era as the Cambrian Explosion Era. So, WE OWE OUR EXISTENCE TO PLANTS, NOT ONLY BECAUSE THEY PROVIDE FOOD, SHELTER, MEDICINE TO US BUT WITHOUT THEM PERHAPS WE WERE NEVER GOING TO BE EVOLVED.
Paul Stamets listed six-ways mushroom (fungi) can save the world. Watch this fascinating video, appearing in TED-Talks, HERE. Many of the mushrooms growing in our garden are also edible, but PLEASE DO NOT TRY it unless you are an expert in identifying them -- eating poisonous mushroom can result in death.