Because exercise consumes calories and burns fat.
However, an exercise should last at least 30 minutes to achieve the effect of losing weight.
Moreover, if the exercise body accumulates 3500 calories a day, the body will store 0.45 kilograms of fat, which is the way for the body to store energy and plan ahead. On the contrary, if the energy consumed is 3500 calories more than the intake (whether due to increasing exercise or reducing diet), the body will convert the stored 0.45 kg of fat into energy to make up for the deficiency.
I hope it helps you.