Metabolic pathways are extremely complex, but here I will give a snapshot of a cross section of the pathway for Vitamin B12. At the center of the molecule there is a cobalt atom which is first converted to Co3+ and then to Co+ by flavoprotein reductase enzymes. Co+ is a very strong nucleophile: read, it has a very strong attraction for positive charges. It thus attacks the number five carbon on ATP causing a reaction which forms 5’-deoxyadenosyl-cobalamin. This active form of the vitamin can be used in other metabolic pathways for a plethora of things.
It should be noted that Vitamin B12 does not occur commonly in nature but can be converted through the above pathway into an active molecule which can then be run through other metabolic pathways to be used in biological systems.