Protein is a overall label for a particular type of complex organic molecule. There is not just one thing called protein, there are many different type of proteins.
There are even proteins that are toxic to the human body. And certain people can be allergic to some proteins that others are not.
Peanut are not protein, rather they contain proteins that the body can use. Some people just happen to be allergic to a certain protein in peanuts. That doesn't make them allergic to "protein", just a certain one.