hi, it could be a form of anxiety. most people who have been diagnosed have needed to physically do something in order to try and suppress their anxiety. idk im not an expert but try going to the doctors and tell them bout this, if you're not too comfortable with that then try talking to someone you know who does something similar to that/has anxiety.
if you're trying to lessen this do a hobby or activity that takes your mid off this, or doesn't give you anything to chew on. maybe try taking you dog out for a walk, if you have one, or reading a book, joining a club at school that doesn't involve mouthguards or pencils