I had awful depression and anxiety prior to starting T. When I mentioned it to my doctor prior to getting my prescription, we had a good discussion about where those things were stemming from. In her view, if they were completely separate and distinct from my gender dysphoria, then I'd probably need to meet with a therapist and talk to them about it, and consider getting some medication directly for that.
But in my case, it was all gender related. My depression was due to the fact that I knew I was trans at 17, had just turned 25, and felt like I was wasting my adult life. I didn't want to live anymore entertaining the lie that I was a happy, cisgender female. My anxiety was due to the fact that medical transition, which I knew I needed, involved doctors and I've had nothing but negative healthcare experiences up to that point. Socially, I was borderline agoraphobic because I had had an androgynous presentation for so long. I never felt comfortable in situations that required gendered choice making in public - using the restroom, going clothes shopping, etc.
Within a few months on T, my depression was gone. I felt like I was finally making progress towards the life I should have been living this whole time. As I masculinized more and more, my social anxiety went away. And due to the terrific care I've received from all of my healthcare providers since coming out, I don't have any anxiety related to that either.
So I'd suggest sitting down and maybe writing out all of your feelings and seeing what you can trace them back to. What's the root cause? If it's gender related, T may be the best anti-depressant you'll find