Cheese sweats because condensation forms on its surface when it's exposed to warmer temperatures outside the refrigerator. The moisture inside the cheese migrates to the surface and condenses as the cheese warms up.
Cheese contains water, and when it's cold, that water is held within its structure. When you take cheese out of the fridge, the warmer air around it causes the cheese's temperature to rise. As the cheese warms, the moisture inside becomes more mobile. This moisture then migrates to the surface of the cheese.
The air surrounding the cheese also contains moisture. If the cheese's surface temperature is lower than the dew point of the surrounding air, condensation will occur. The water vapor in the air will condense on the cheese's surface, adding to the 'sweat.' The higher the humidity and the greater the temperature difference between the cheese and the environment, the more pronounced the sweating will be. Different types of cheese will sweat at different rates depending on their moisture content and fat content. Softer cheeses with higher moisture content will typically sweat more than harder, drier cheeses.
To minimize cheese sweating, only take out the amount of cheese you plan to consume immediately. If you need to keep cheese at room temperature for a short period, wrap it loosely in cheese paper or parchment paper to allow it to breathe while still protecting it from excessive moisture loss.