Hello!
Your body produces sweat in order to prevent yourself from overheating. The sweat comes from the sweat glands and condenses on the skin. This helps to keep the body cooled down so you do not die from overheating or exhaustion. Drinking more water can also allow you to sweat more which is also important for your body.
I hope this helped!
I am, yours most sincerely,
SuperHelperThingy