Certain protein molecules in the mushroom, called enzymes, enable the chemical reactions necessary to combine or convert the substrate molecules into the desired products. The image to the right is a ribbon presentation of the enzyme, with its cofactor, SAM (S-Adenosyl-Methionine), bound to it (yellow shaded molecule. As you can deduce from the previous page, this enzyme is PsiM, and the SAM donates in two successive reactions methyl groups to norbaeocystin, yielding the end product psilocybin.
While we know much about the required chemistry, we do not know how the detailed mechanism of the methyl transfer works in PsiM. The depicted molecule is only a computer model, based on similarity to other methyltransferases. The parts in red, where the norbaeocystin likely binds, have no similarity to known enzyme structures and must be determined experimentally.