If you consume more calories than you burn, you will gain weight. If you burn more calories than you consume, you will lose weight. However a big caveat: while a calorie is a calorie, the body is not a closed system. What you consume affects metabolic and hormonal secretions which may cause you to store fat instead of expend fat, and vice versa. This is why the type of foods and beverages we consume are crucial.
Exercise is a variable that increases caloric expenditure and metabolism.
Diet Transitioning
When transitioning from a bulk to a cut or vice versa, adjusting calories slowly by 200 to 250 calories per week gives the body time to adapt psychologically and physiologically. Your weight will still change during this transitioning phase.