I wish I knew. I’ve had this bad habit since I was about 6. I don’t care for psychoanalysis much at all, but I do seem to have an oral fixation. I find that the only time my nails grow out properly is if I am not stressed at all, which happens for about a 1 week period once a year, haha.
Maybe you could try putting some lotion on your fingertips so that they taste bad? Do you chew gum? If not, maybe you could start doing that to distract yourself. Hopefully someone else will have a better remedy…