That used to be me. Chemically, training helps. Mentally, it's a bit more complex than pure chemicals, and this is one of the reasons why.
To advance the problem, the fitness industry thrives on selling certain types of physiques and the hope of looking like them. This isn't evil in itself, and I generally think that people need to stop being such whiny cry-babies when they go blaming marketing for all their problems. But when you go ahead and hang your value as a human being on your body image, or on how much you can lift, or some such measure, you're never going to have the self-worth that you're looking for. You'll keep digging into the wells of fitness in the hopes that it will make you worthy and acceptable, and it will disappoint you 100% of the time. Moreover, training with such motives (as many do) with depression or anxiety is a good recipe for body dysmorphic disorder or an eating disorder -- the people who seem most likely to get such messed up disorders tend to be high achievers who stake their value on some kind of success (not necessarily business success (there's another rant there)).
I reckon depression and anxiety affect my training more than the other way around. That's partially because the ideal protocol for training for mental health is basically to train as if you're using ice as a pre-workout, whereas I go ahead and do stupid things like rest between sets. And it's partially because, as I said above, the mind is more complex than chemicals. Dealing with my mind always works way better than dealing with my chemicals.