1 Glycosyltransferases (GTs) are prevalent across the tree of life and regulate nearly all aspects of 2 cellular functions by catalyzing synthesis of glycosidic linkages between diverse donor and 3 acceptor substrates. Despite the availability of GT sequences from diverse organisms, the 4 evolutionary basis for their complex and diverse modes of catalytic and regulatory functions 5 remain enigmatic. Here, based on deep mining of over half a million GT-A fold sequences from 6 diverse organisms, we define a minimal core component shared among functionally diverse 7 enzymes. We find that variations in the common core and the emergence of hypervariable loops 8 extending from the core contributed to the evolution of catalytic and functional diversity. We 9 provide a phylogenetic framework relating diverse GT-A fold families for the first time and show 10 that inverting and retaining mechanisms emerged multiple times independently during the course 11 of evolution. We identify conserved modes of donor and acceptor recognition in evolutionarily 12 divergent families and pinpoint the sequence and structural features for functional specialization. 13Using the evolutionary information encoded in primary sequences, we trained a machine learning 14 classifier to predict donor specificity with nearly 88% accuracy and deployed it for the annotation 15 of understudied GTs in five model organisms. Our studies provide an evolutionary framework for 16 investigating the complex relationships connecting GT-A fold sequence, structure, function and 17 regulation. 18