This pattern in students is very perplexing for both teachers and parents. Start by meeting with your child’s teachers to assess his learning situation. A comprehensive educational evaluation could inform the discussion as well. This evaluation would provide an analysis of his strengths and weaknesses, which could give you clues about what types of interventions would work best for him.
It is also important to distinguish between poor grades due to low skills (attention, organization, academic) or poor grades due to low motivation (boredom). These two causes will require different types of intervention. Here is an article that discusses the frequent connection between ADHD and giftedness.