Cheese, to state the obvious, is a food product. That means that in order to enjoy it at peak flavor, it needs to be kept under the right conditions. For most cheeses, most of the time, that means storing it away from exposure to air and at a cold temperature.
That doesn't necessarily mean storing it in a refrigerator, a good wine cellar might be appropriate in some cases. But for most people, the refrigerator is the most convenient and most effective means of storage. Keeping the cheese well sealed, and between 33°F-38°F (0.5°C-3.3°C), is optimal for almost all cheeses.
Softer cheeses, so-called fresh cheeses such as cottage or Mascarpone (a white Italian cheese) or Brie, are the most vulnerable. 'Fresh', in cheese circles, doesn't mean unspoiled, per se. It refers, instead, to the relatively short aging period. Since they're high in moisture, they spoil the most easily. Airborne mold spores combine more readily with food when they have water molecules to latch onto. But even stored correctly, they should be consumed with a few weeks at most, two weeks in most cases.
Even when inside a tightly sealed container, if they've been exposed to air at all, there's typically enough oxygen inside to cause considerable spoilage of the surface. That spoilage can propagate to the interior to a degree. Even if that process doesn't proceed very far, soft cheeses are harder to 'fix' by carving off mold spots or moldy surface areas than harder cheeses.
Harder or semi-firm cheeses will last 4-8 weeks if kept well-sealed and wrapped. It's helpful if the wrapping is close to the cheese. That keeps air away from the surface that is inevitably trapped inside the container. Aged cheese can last longer, especially if it's vacuum packed. Small commercial devices for vacuum sealing cheese and other foods are readily available.
Hard cheeses, such as Parmesan or Asiago (a crumbly Italian), can last a very long time but, if not frozen, after a couple of weeks they will lose flavor. When frozen they can be stored for up to about three months.
If you need long term storage in the freezer, be sure to transfer the cheese to the refrigerator for at least a few hours before bringing it out into the kitchen. The more gradual thawing process will help preserve the flavor and texture.
Other cheeses, such as Gouda or Cheddar, don't react well when frozen, even if thawed properly. It's best simply to refrigerate and consume before they spoil. That can be as long as three weeks if they're kept properly. Processed cheddar will last a bit longer, but a gourmet cheese has a much shorter life span.
Left out in the room, even if covered, some cheeses will become oily, a result of fat molecules oozing out of the block as they melt. That can make for an interesting taste variation, but the process shouldn't be allowed to go too far. Serving at room temperature is ideal for most cheeses though slicing is easier for slightly cold cheese. But after a few hours in air most will alter in undesirable ways.
Airborne spores are the primary cause of spoilage and they interact readily with cheese. Heat, per se, isn't the culprit but it encourages most chemical reactions to speed up. So, keeping things stored and cooled will keep your cheeses optimal.