Likely you and many others here and elsewhere as well, including children of those reading this, which is why I write it. If you have a gifted child, promote them! Learn about their needs and get them the educational resources they and society deserve.
The problems you both mention are the result of forcing gifted students to follow a mass education system. Evidence shows that such students should be in an IEP (Individualized Education Program). Many times, the gifted students also have problems with anxiety, depression, social isolation which makes them what's called "Twice Exceptional" students. Such students are written off, like you were, because teachers can't comprehend why such a bright student would struggle.
Such students are also misdiagnosed with ADHD, aspergers, anti-socialism, etc. A poignant distinction between giftedness and aspergers I just read recently is that the aspergers student is a social outcast and has no idea. The gifted student is a social outcast and feels terrible about it.
I think it's a huge injustice. The minds and capabilities of our brightest are a gift to our society and we are letting the treasures waste away.
I've been struggling a lot lately with a lot of issues and re-discovering the problems gifted people have in society has helped me put it back into perspective. What I and you and probably lots others are experiencing aren't the result of something being "wrong" with you, but rather perhaps too much of a good thing can be a bad thing?
For more info:
https://www.sengifted.org/post/can-you-hear-the-flowers-sing...
http://www.stephanietolan.com/gifted_ex-child.htm
http://www.metagifted.org/topics/gifted/adultGiftedness/