Almost all fungus produce various types of mycotoxins, mushroom poisons. They do this because it’s their way of defending themselves from bacteria.
Funnily enough not all mushroom poisons are effective against humans. Humans are quite resistant to a lot of different toxins, like those in chocolate, onions, tea etc etc. Some of the stuff that’s very bad for some of our best friends like cats and dogs. The varieties of Penicillin for example, the mushroom poison in blue cheese, is straight up lethal to guinea pigs. But not to humans, although some have allergic reactions.
It all depends on the capabilities of our livers, the organ that’s primarily responsible for breaking down toxins in our body, and exactly how our cells function inside. Allergic reactions depend on how the immune system identifies threats. Every animal is slightly different in that regard, and some can eat stuff that we would consider poisonous, and to some our every day foods are pure death.