Nobody gains weight overnight. It happens gradually over the years or decades. Average adult tends to gain 0.5-1.0 kg per year, which is quite a lot actually. But no worries if there has been some weight gain, exercise helps.
The thing is that most of this yearly weight gain happens during mid-November and mid-January, thus during the common holiday period. An important thing is that even if we manage to loose some of this weight gain over the next few months, some of it persists and it gradually accummulates. Holiday period is challenging in this respect as new research shows that even those who actively try to loose weight still manage to gain at least 0.3 kg over the holidays.
But no worries if there has been some weight gain. We have a medicine for that, which is physical activity. Physical activity increases your energy consumption, which burns calories and fat stores and helps you to loose weight. But it is not only that exercise helps you to loose weight but exercise also affects basically all our organs and cellular functions, contributing to better health even if you do not loose weight. Exercise also prevents weight gain and actually allows you to be a bit more flexible with eating.
Thus, it is good if you manage to loose some weight if that is an issue, but loosing weight does not have to be the major reason to exercise. Being physically active daily is the most important thing (together with nutrition and sleep) you can do for your health no matter what is your body weight.