The fat gain bit?
First law of thermodynamics, energy going into a closed system cannot be created or destroyed but has to be changed.
Putting it into food terms if you eat it you either have to burn it or you're going to store it. We store excess calories partly as
glycogen and partly as fat.
If you were asking about how I lose it that's in theory easy, I drop from my current 3,000 calories a day to about 2,000 calories, a shade over my
BMR, by reducing my fat and carbohydrate intake though not my protein intake, and exercise enough to burn more than 2,000 calories a day putting me in negative energy balance and once I've depleted glycogen store enough burning fat.