Forget the gym bag and just consider the shoes.
If you stood barefoot holding the shoes in your hand, you would be expending more energy than if you stood there wearing them, because your arm, shoulder and legs have to provide a constant effort to resist to the effect of gravity on the shoes.
Going up the stairs, your legs have to do the same amount of work to move the shoes up a floor whether you're wearing them or carrying them, but when you're carrying them, your arms, legs and torso also have to expend that constant effort to suspend the shoes in the air. If you wear them, each shoes is only suspended in the air half the time, and only your legs are holding them up. So technically you're doing same amount of work either way, but expending more energy if you carry them. Another way of saying it, is that carrying shoes upstairs on your feet is more efficient than carrying them upstairs in your hands