Sweating at night is often associated with severe disease. Medical doctors learn that night sweats can be a sign of cancer, especially lymphoma. If you google night sweats you quickly end up on the web pages about cancer. If you do experience night sweats, it is obviously important not to wait but to seek medical care, because in worst case it can be a sign of severe illness. You should never try diagnosing yourself, for example after googling.
What many do not know is that there are forms of hyperhidrosis, excessive sweating which cause trouble mainly at night. The mechanism behind nocturnal hyperhidrosis is not completely clarified, as is the case for virtually all forms of hyperhidrosis. One hypothesis is that variation in sleep depth in combination with disturbed thermostat (which is the case in hyperhidrosis), causes night sweat. These people have a genetic variation that makes the sympathetic nervous system and the thermostat oversensitive. When we sleep, the sympathetic nervous system is programmed to rest but if there are nightmares, snoring, or anything else that disrupts sleep, one can get so-called “micro awakenings.” This means shallow sleep more often, even if you do not become aware / fully awake. Then, when the body wants to go into deep sleep again, the body wants to lower its body temperature about one degree (as is the case for everyone when we fall asleep) and when this happens often, in those with sensitive thermostat, you get “sweat attacks”. Thee attacks can be quite disturbing because one has to change clothes and / or sheets often, sometimes several time a night. Today there is no cure for this but, like other types of excessive sweating, it can be treated with for example injections while some benefit from medication that stabilize the depth of sleep. Consult your doctor. This is probably something that all doctors are not familiar with. You should contact a specialized hyperhidrosis clinic.