Awareness and willpower. I bit my nails for years... pretty much til I was like 16. I found that I had done it for so long that I wasn't even really aware when I was doing it, which was often. A big part of it was forcing my own awareness. When I caught myself doing it I had to substitute another habit. I started putting lotion on my hands whenever I did it. Let me tell you, my hands were VERY moisturized the first week.
Then I started painting them properly with base coat, polish and top coat twice a week. If you have some good fast dry top coat it will cut your manicure time way down. This not only strengthens them but when you spend time to make them look super nice it really slows you down from chewing them. If they are chipped and peeled it's much easier to chew them.
Retraining yourself usually takes about 2 weeks. After that I didn't even have the urge to.
Sincerely,
The Reformed Nail Biter