This is my "bro science" take as a pretty active weight lifter.
It has to do with your body being in a catabolic vs anabolic state. Keeping yourself in a catabolic state will cause weight loss, anabolic is your body building itself up.
Training while in a catabolic state (calorie deficit) your body will breakdown fats and proteins because it does not have excess carbohydrates to use as fuel.
Training in an anabolic state (calorie surplus) your body will store fats and build muscle (proteins) and burn excess carbs.
It just depends on your goals. Weight training in a catabolic state will basically burn fats and you will maintain muscle.
Wights in a anabolic state your body will store carbs as fat while it builds muscle.
I think there is a balance where you can find a happy medium if you want to maintain your body type. Generally I just listen to what my body needs/wants and feed it when I know it's going to want fuel or does not need fuel.
When I'm heavy into the weights I eat like a freak, heavy on proteins and carbs; basically I want to feel semi full all the time. Your body needs excess calories to build muscle. Generally along with that you store some fat. Lots of people call this "bulking" (anabolic); calorie surplus. Something close to eating every 4-5 hours and alot less sleep (body needs less rest because it has excess fuel).
Alternatively when I'm feeling a bit heavy/fat after bulking I'll start "cutting" (catabolic); calorie deficit. Im moderately hungry a lot. But my body is burning that fat off. More so lean in on cardio, weights in this state will generally just maintain strength. Eating every 6-8 hours alot more sleep (body needs more rest to rebuild because it lacks fuel).
Your body does not just switch into anabolic or catabolic quickly, usually takes a week or two for your body to adjust to the changes in caloric intake. Generally feels like "resetting" your appetite. All depends on your goals!