I was biting a piece of dead skin on my finger when suddenly there was severe pain through my finger. It stopped but what caused it?

Maybe that skin... ...Wasn't quite dead yet! you may have injured some nerve endings in the still-viable skin. Alternatively you could have had a muscle spasm, although that would make the biting episode coincidental.
Nerve endings. There are sensory nerves in the superficial layers of skin responsible for touch and feel. There are also pain receptors. The skin was probably still attached and when you bit it, it sent signals down the nerves causing you pain.