If you chew gum with sugar in it, you need to chew for twenty minutes or more in order to produce enough saliva to wash away a significant amount of the sugar residue. Even then, it’s a good idea to brush your teeth afterward.
If you are grinding your teeth you could be wearing the enamel down, as well as causing damage to your jaw. When we’re asleep, we’re capable of grinding our teeth six times as hard as we might in the day. That kind of pressure can do a lot of damage.