The diffusible factor synthase XanB2, originally identified in Xanthomonas campestris pv. campestris (Xcc), is highly conserved across a wide range of bacterial species, but its substrate and catalytic mechanism have not yet been investigated. Here, we show that XanB2 is a unique bifunctional chorismatase that hydrolyses chorismate, the end-product of the shikimate pathway, to produce 3-hydroxybenzoic acid (3-HBA) and 4-HBA. 3-HBA and 4-HBA are respectively associated with the yellow pigment xanthomonadin biosynthesis and antioxidant activity in Xcc. We further demonstrate that XanB2 is a structurally novel enzyme with three putative domains. It catalyses 3-HBA and 4-HBA biosynthesis via a unique mechanism with the C-terminal YjgF-like domain conferring activity for 3-HBA biosynthesis and the N-terminal FGFG motif-containing domain responsible for 4-HBA biosynthesis. Furthermore, we show that Xcc produces coenzyme Q8 (CoQ8) via a new biosynthetic pathway independent of the key chorismate-pyruvate lyase UbiC. XanB2 is the alternative source of 4-HBA for CoQ8 biosynthesis. The similar CoQ8 biosynthetic pathway, xanthomonadin biosynthetic gene cluster and XanB2 homologues are well conserved in the bacterial species within Xanthomonas, Xylella, Xylophilus, Pseudoxanthomonas, Rhodanobacter, Frateuria, Herminiimonas and Variovorax, suggesting that XanB2 may be a conserved metabolic link between the shikimate pathway, ubiquinone and xanthomonadin biosynthetic pathways in diverse bacteria.