When psilocybin finds its way to your stomach, and later on also your intestine, your blood absorbs the psilocybin. When people eat magic mushrooms, the advice is always to chew them really well so that the psilocybin can be more easily absorbed. The blood is then filtered in the liver (coming there via the hepatic portal vein) where a large part of the magic happens.
But, before we move on, there is one thing we didn’t mention about magic mushrooms/truffles, and that is that they contain a large amount of psilocin. This is the active ingredient and the one in which psilocybin will transform in our section below. So when taken in their natural form, an amount of psilocin that is about equal to psilocybin is already in the right format.
Let’s break this down (pun intended).
Dephosphorylation is the removal of a phosphate group from an organic compound (psilocybin in this case) by hydrolysis. Phosphate can be seen as a small group of molecules that are in this case being removed from the rest. Hydrolysis is the chemical reaction by which a water molecule ruptures the chemical bond (thus separating the phosphate group). When your body is breaking down more complex carbohydrates into glucose and fructose (sugar as we normally understand it), it’s also employing hydrolysis.
The enzymes doing this is called alkaline phosphates. Enzymes are proteins and biological catalysts that make happen or accelerate chemical reactions. Alkaline phosphates are proteins that work best in alkaline (basic not acidic, e.g. bleach) pH levels.
So in short, your body employs common mechanisms to transform psilocybin into psilocin. This process happens in the liver.
One last thing of note for the liver is the phenomenon that is called 'first pass effect'. This stands for the loss of a certain percentage of a drug (about 50% for psilocybin) that is lost during the process of absorption and that doesn't reach the blood. This process also happens with alcohol, and a reverse (strengthening effect happens with cannabis). It's unclear if everyone has the same first-pass effect or if this may vary between people based on several factors (bodily, stress, activity, etc). This paper suggests that only 20% of psilocybin finds its way to become psilocin.