Easy. Hypnosis. What you are doing is a subconscious act. You are biting your fingernails and doubtfully are even aware you are doing it. Nobody bites their nails because they want to. They certainly don't taste good. What hypnosis does is change that subconscious act into a conscious one. When you are now aware that you are about to bite your fingernails, you can stop the action before doing so. Works like a champ. Contact a local hypnotherapist and they can give you more information. It's usually a one-and-done session.
Think about all the dirt and grime under your fingernails every time you go to bite them. Also, if you put something nasty on them like hand sanitize or something it will taste bad to bite them. I've had this problem too.
I had the same problem years ago, but it all stopped when I started playing guitar (fingerstyle) my suggestion is that whenever u do it; try to remind yourself that there are so many germs and bacteria under them... or u can use some kind of medicine and every time u bite them, there will be an awful taste, so u'd stop.