Dear student,
Sweat glands are thermoregulatory, when the body temperature increases the hypothalamus sends signals in response to which sweating happens.
Body temperature increases only when we are tired or playing and not when we are sitting under a fan or air conditioner.
Regards