On the underside of the cap of a mushroom is a structure with many brown leaves closely spaced together like slats or a louver.
What is the purpose of this structure?
These thin, closely-spaced structures are commonly called gills (in more formal contexts a gill is called a lamella). Our most familiar mushrooms have gills, but there are other species that do not have structures of this form.
The gills exist for reproduction. Mushrooms spread by producing tiny spores that disperse on air currents. (In fact the entire mushroom structure exists for this purpose; the main part of the organism, a fungus, is a diffuse web under the ground or other substrate.)
Mushroom spores develop on surface tissues so that they can be released into the air. The gills evolved to provide more surface area so that more spores can be produced and released (up to twenty times the area of the supporting surface). The gill spacing is important because the spores are shot out of the surface, are slowed by air resistance, and then fall downwards from between the gills. (Source: Why mushrooms form gills: efficiency of the lamellate morphology)
The structures you're referring to are called "lamellae" or "gills". They are coated in the spores that the fungus to reproduce. Specifically you find them on Basidiomycete and Agaricomycete fungi.
By being 'vented' and hanging beneath the cap of the mushroom, it allows the wind to blow past and dislodge the spores, to fall and then be carried off and plant themselves somewhere new - in much the same way seeds would fall from plants.