It's the chemical properties of certain mushrooms. Some mushrooms and some other plants contain chemicals with hallucinogenic properties.
Hallucinogens were found in nature before they were ever manufactured, and certain species of mushroom are one source, that's all. Hallucinations and the experience of tripping are just the way the brain reacts to those chemicals.