It's a bad habit that we often see it in many kids, and this is either nervous or embarrassing.
How to deal with it:
-If you find it, you do not have to yell and start the punishments, because in this way all you can do is to upset it even more. Make sure their hands are most busy with something.
- Cut their claws close enough and then rub them with a little bit of almond oil or petrolatum. This way when he gets bite, he will slip.
-Scribe a line with a red marker secretly on the nail polish (do it in his sleep) and tell him that if he bites his fingernails, he will blow his hands. Do not use pepper or hot pepper because it can irritate its skin.
You need to get more involved with him so you can discover what is leading him / her in this habit.