My child did this also. Usually they do not bite that hard that they actually hurt themselves. One of the things that I said to her (which I noticed helped) was "Oh, you are biting yourself again. Can I try biting you also?" The answer was a shocked look and "No!" She stopped after that. I like to try to think of something that will get them thinking and once they are thinking and processing the information of something they were not expecting, the child forgets about the biting, scratching, banging etc. My child did it all and she was a very bright little girl. I believe they do it for attention.
You may also try distracting her when she goes to do it, put some music on loudly, dance around with her, read a story, she may also do things like this as a habit out of boredom and a wish for attention, but first get her looked at by the Pediatrician...
It may be a good idea to check no one is doing it to her and she is copying, she is showing frustration.. I think as she is so young its a good idea for her to see her Pediatrician , there is a reason she does this, has she any older siblings, or relatives she is around does she go to day care or pre k. I know children can bang their head when they have earache for instance so her ears could do with being checked out, does she eat well ..