Catalyzes the SAM-dependent triple methylation of the alpha-amino group of histidine to form hercynine and subsequent conjugation with cysteine and oxygen to form hercynylcysteine sulfoxide, the first two steps in the biosynthesis pathway of ergothioneine (PubMed:24828577). May play a role in meiosis (PubMed:16303567). L-histidine + 3 S-adenosyl-L-methionine = 3 H(+) + hercynine + 3 S-adenosyl-L-homocysteine hercynine + L-cysteine + O2 = H2O + S-(hercyn-2-yl)-L-cysteine S-oxide Binds 1 Fe(2+) ion per monomer. Amino-acid biosynthesis; ergothioneine biosynthesis. Completely lacks ergothioneine and its precursors (trimethyl histidine/hercynine and hercynylcysteine sulfoxide). In the N-terminal section; belongs to the methyltransferase superfamily. EgtD family. In the C-terminal section; belongs to the EgtB family.