In my law school class, there were many people who were smart and well-liked and also spoke up in class. There were also people who talked for the sake of hearing their own voice, belittled others openly, and were generally hated by all except other gunners.
Some examples of "gunner" behavior":
In my Federal income tax class, there was one gunner who delighted in coming up with increasingly convoluted hypotheticals to try and stump the prof.
There were a group of gunners on law review whose pre exam routine was telling each other (rather loudly) that they were smarter and better than everyone else in class and that there was no reason to worry about getting a bad grade.
In my Con Law class, some of the Federalist Society douchebags would debate the prof on cases like Roe v. Wade and Brown v. Board of Education, where the holdings went against their personal beliefs.
One of the TA's in my first year legal writing class had attracted the attentions of a gunner. In a move I'm sure he found charming, he would corner her and then grill her about upper level classes he was thinking of taking. It got so bad that a few of us felt compelled to rescue her whenever we saw this happening. She always effusively thanked whoever got her away.
Finally, at my school, there's a special part of graduation where the graduates of every school walk the campus to the football stadium. The valedictorian of each class held a flag denoting which school they were representing. Everyone usually cheers for their flag bearer. Our flag bearer was so hated and so obnoxious that only his own family cheered him when he was announced as the law school's flag bearer. To this day, I do not feel bad about this.
So, it takes more than simple smarts and engagement with the material. You have to possess a sociopathic malice and disdain for your fellow students while maintaining an unjustifiably high level of self regard.