Short answer: the fruiting body, with a few parts trimmed
For most edible wild mushrooms, the cap, stem, and gills (or pores or teeth) are eaten, with some trimming. The mycelium underground is usually not eaten. Before you cook, trim the base, remove anything damaged or infested, and check for a volva. If you find a volva, do not eat the mushroom until an expert has identified it.
Caps
Most edible caps are eaten whole. Some caps have a slimy or leathery skin, and many cooks peel or scrape it away for texture. Peeling is a cooking choice, not a safety test. Peeling the cap does not separate safe mushrooms from deadly ones.
Stems
Stems of most edible species are eaten, but some are too tough to enjoy. Shiitake stems are commonly discarded because they are woody. Many bracket fungi, such as reishi, are too tough for ordinary cooking and are usually prepared in other ways. Trim the base where it is dirty or woody, and save tough stems for stock, where long simmering softens them.
Gills, pores, and teeth
Gills are eaten on most gilled edible species. Some cooks remove them because they darken as the mushroom ages, leave dark specks in a dish, or add a texture some people dislike. Gills on older specimens can also be soft or slimy, so check them before cooking.
Pores on boletes are often removed from older mushrooms, where they can become soft or slimy. Some boletes are bitter, and some are toxic, so identify the species before you eat any. Hedgehog mushrooms are eaten with their spines in place.
Morels and other mushrooms that need extra care
Morels are eaten whole, but they need more preparation. Cut them lengthwise to check for insects and debris, then rinse them gently. Cook morels thoroughly. Eating them raw or undercooked is not advised, and some people get stomach upset from morels even when they are cooked. Morels also have dangerous look-alikes, which are covered in a guide to when not to eat a morel mushroom.
Cleaning and cooking
Brush off dirt with a soft brush or a damp cloth. A quick rinse is fine, but soaking can waterlog mushrooms, so dry them before cooking. Cook most wild mushrooms fully. Cooking does not make a toxic mushroom safe, since many toxins survive heat.
Try a small amount first
People react differently to the same mushroom, even when it is correctly identified. Eat a small portion of a species you have not eaten before, and wait before eating more. Some species cause trouble when combined with alcohol, so avoid drinking with a new species until you know how your body responds.
Safety
Only eat parts of a mushroom you have identified with certainty. Removing parts does not make a deadly species safe, because toxins can be spread throughout the mushroom. For a wider look at which fungi can be eaten, check a guide to that topic, but treat any list as a starting point and confirm the specimen in your hand.