L.R.
Because of his age, have him evaluated by an occupational therapist. He may need to have some form of oral stimulation (chewing, sucking) in order to to concentrate. Does he do this in school? While doing homework? During tests? Does he suck on pencils, chew on erasers too? Does he have his fingers in his mouth whenever he's concentrating on anything? He may be like my friend's son, who actually has an independent education plan document with the school, allowing him (because his occupational therapist said it's needed) to chew on specific items during class. It helps him focus and concentrate much better.
The need to chew or suck is very strong in some kids and is more than just a "bad habit that needs breaking" -- it's a hard-wired need in their psyches, so please don't shame him, punish him or fuss at him. Instead, I'd get him to an OT who is very experienced with elementary-aged kids and ask if he possibly needs this kind of oral or other help. Kids do often outgrow thiis with occupational therapy help so it won't be forever but kids like this also often still chew gum a lot as they get older. But again, get him evaluated rather than telling him how bad this is for him. Yes, it's not great, but it just may not be a bad habit.
The things my friend's son gets to chew on, by the way, are specific, approved "chewies" that are sold especially for kids with this kind of oral need, and the teacher is supposed to let him use them during class.