My 11 y/o son does this too. Part of the reason is he doesn't have good impulse control. Another part is that he is bored in the class or because that part of the class has become unstructured and he doesn't know what to do with himself. Plus, he has ADHD, so that can be thrown in as well.
We put this into his Behavioral Plan in the IEP we set up with the school. He is allowed to have a stress ball to fiddle with, and they give him rewards for keeping his hands to himself. We still have problems, but with maturity and the behavioral plan, things are getting better.
_________________
A foolish consistency is the hobgoblin of small minds. ~ Ralph Waldo Emerson