This could be for many reasons. Maybe he is not challenged in class. Maybe he has trouble paying attention. Maybe he is more interested in socializing than learning. Or maybe it is a combination of all three. Have you taken him to a child pscyhologist? There you could get him evaluated to see if he has ADHD. Many children with ADHD exhibit the kind of behaviors you mention. If he does, than it may truly benefit him to either get medication or seek out some social skills therapy to help him succeed while managing his ADHD. There is certainly a lot of effective treatment.
We also would like you to communicate with the school regularly and try out different techniques to get him to pay attention better. A rewards system, a check in system, or an undistracting coping technique could benefit him and help the entire class as well. Speak with the school counselor to see if she has any ideas or plans that you think may benefit your son in this situation.
Also continue to communicate with your son yourself and reward him when he has good days. Catching our kids being good is even more important than reprimanding them when they are bad. Guide and support him through this. It is very likely he wants to be behave, but simply doesn't have the skills. Ask him what he needs and what would help. He may be able to tell you.
Please take care and remember that you can call the Boys Town National Hotline 24 hours a day at the number below, free of charge to discuss any parenting issue. We are here to help, you are not alone!
Boys Town National Hotline-A Resource for Parents and Teens