Where did I lose control of my studies?
Nothing you've described sounds like a serious academic problem.  Taking weeks to understand a paper, and working on a problem for weeks without results, are entirely normal in research mathematics.  And there is always a large gap between what you learn in coursework and what you need for research.  

Trying to get better by just working harder or longer can be counterproductive.  It is important to spend time on other things, even when you feel like you're way behind.

Clearly you have some problems with mental health right now.  I'm not qualified to advise you on that, but it's good that you're getting professional help, and it's only been 1.5 months - such issues don't usually get "cured" as quickly as that.  Even if it takes time to get better and delays your academic progress, that's not a major problem.  Academia works on very long timescales and several months of low productivity is nothing in the big picture.

At the end of the day, maybe you'll decide you just don't like doing mathematics research.  That's okay too, there are lots of other things you can do with your life.  Math is particularly difficult in this regard, in that math coursework has a very different flavor from doing research (exercises with short elegant solutions, versus long messy problems with awkward solutions that only accomplish half of what you really want).  Liking coursework is not necessarily a good indication of the same for research, so a lot of people do leave the field at this stage.  Again, there is nothing wrong with that.

Professional mathematicians tend to be people who really do enjoy doing mathematics research, and they tend to describe the work in terms that make it sound like it is inherently enjoyable and anyone that doesn't like it must be broken somehow.  But that's not true.  If you get better and discover that you enjoy it, great.  If not, that's great too.