It actually sort of has a logical throughline. Some people genuinely struggle in classes for subjects they're genuinely talented at because they're so far ahead of the rest, or simply because the curriculum is designed in a way that isn't conducive to the way they learn, so they can wind up learning more from independent study, or even revolutionizing the field entirely, despite having atrocious grades most of their early lives.
Of course, others wind up being demoralized and lose interest entirely in the field they would have been so talented at, which is one of the many ways that the schooling system is flawed and needs serious reform, not just funneling more money into it and hoping for the best.