Your brain runs on chemical messengers β neurotransmitters like serotonin and dopamine β each shaped to fit specific receptor proteins on the surface of neurons, the way a key fits a lock. The "classic" psychedelics work because they are molecular forgeries: their shape is close enough to serotonin that they slip into its receptors and turn them on.
The crucial keyhole is the serotonin 5-HT2A receptor. Decades of pharmacology converge on it: drugs that activate 5-HT2A produce psychedelic effects, and drugs that block it abolish them. When a tryptamine like psilocybin or DMT binds there, it doesn't just switch a neuron on or off β it changes how whole networks of cortex talk to each other, which is why the effects are perceptual and cognitive rather than, say, a twitching muscle.
This is the deep punchline of the whole story, in molecular form. A plant or fungus never "intended" to alter a mind. It evolved a compound that happened to resemble an animal's own signalling chemicals closely enough to jam them β and in our particular brains, that jamming registers as visions, dissolved boundaries, and revelation.