yes, i think most people who've went to the gym generally improve their mental state. From personal experience, I can also say it helped. I believe the reason that going to the gym helps is not exactly b/c of satisfaction w/ appearance, but rather b/c the opportunity to actively experience discomfort. experiencing discomfort is acc a v important (and often ignored) step in mentally improving yourself. we r so accustomed to doing things that make us "feel good" momentarily, i.e. sleep in bed, rot in our rooms, etc instead of challenging ourselves. b/c of that, we never end up accomplishing anything.
additionally, going to the gym proves that we have some sort of control over our bodies, since the development of muscles and/or loss in weight is evident. v empowering when you feel powerless.