Comparative genomics of the bacterial thiamin pyrimidine synthase (thiC) revealed a paralogue of thiC (bzaF) clustered with anaerobic vitamin B12 biosynthetic genes. Here we demonstrate that BzaF is a radical S-adenosylmethionine enzyme that catalyzes the remarkable conversion of aminoimidazole ribotide (AIR) to 5-hydroxybenzimidazole (5-HBI). We identify the origin of key product atoms and propose a reaction mechanism. These studies represent the first step in solving a long-standing problem in anaerobic vitamin B12 assembly and reveal an unanticipated intersection of thiamin and vitamin B12 biosynthesis.