Good at coursework and learning background material, but attempts at original research go downhill. How to overcome psychological block? Okay, so I am a math student currently on leave from a graduate program in math and computer science.

I have always been good at coursework. I ace examinations and manage good grades. I can understand and explain concepts well. All my professors have liked me because of all this.

But somehow it feels like I have tricked my way up. Everything goes wrong as soon as I take up a project or open problem or any kind of research. I start out beautifully- read and understand all necessary background instantly, get up to date on current results, impress my guides with my clear understanding. But things go down fast after that. I lose motivation, I get lost in digressions and extensive learning. Or I just slack and avoid the project altogether and somehow try to make a dignified exit.

This has happened too many times now. Each time I thought it'll all come together the next time. But nothing has changed. I have tomes and tomes of notes and expository material on all topics remotely related to my research areas. But I don't have a single original piece of research. It got so distressing that I was diagnosed with depression, OCD, etc. and subjected to medication and therapy. But somehow the problem seems beyond all that. 

I really want to do research and solve problems. Even an insignificant, but original, result might greatly elevate my confidence.
Are there others who have been through this? Is this just a difficult phase some people go through? 
Or am I just an idiot who's reaching beyond his level?
It is hard to give a good answer here, but it seems to me that you, despite being a good student, haven't learned to do research yet.

When you describe what you are good at, you describe all the things you need to be a good student. These things are all necessary to be good at research, but alas, they are not sufficient. To do research, you need to shift to a different gear.

For example: Do not read a paper thinking "How does this work?" but more "What does that mean? What can I do with it? What could be done differently?". Learn to read articles and books through different lenses, e.g. with a lens that focuses on broad understanding of concepts, a lens that focuses on fine details, a lens that focuses on open problems or possible improvements,…

Also, find a problem to work on, not a topic to learn. Ask some supervisor to provide a problem to work on at the beginning, but note that later on you should come up with interesting problems on your own.