It is caused by damp air meeting cooler surface (windshield). Turn on your A/C can remove moisture from air, keep the air dry inside. If you are cold, you can turn on the heat (higher temperature), while also have A/C on. This way, the air comes out is both warmer and drier. hint: turn on you A/C when it snows. the snow you bring inside will melt and evaporate into air due to your heater, causing your windshield to fog up. Having A/C on will fix that too.
A/C should be used whenever you feel the air is damp. It is not just for cooling.