Metabolism has been shown to integrate with epigenetics and transcription to modulate cell fate and function. Beyond meeting the bioenergetic and biosynthetic demands of T-cell differentiation, whether metabolism might control T-cell fate by an epigenetic mechanism is unclear. Here, through the discovery and mechanistic characterization of a small molecule, (aminooxy)acetic acid, that reprograms the differentiation of T helper 17 (TH17) cells towards induced regulatory T (iTreg) cells, we show that increased transamination, mainly catalysed by GOT1, leads to increased levels of 2-hydroxyglutarate in differentiating TH17 cells. The accumulation of 2-hydroxyglutarate resulted in hypermethylation of the Foxp3 gene locus and inhibited Foxp3 transcription, which is essential for fate determination towards TH17 cells. Inhibition of the conversion of glutamate to α-ketoglutaric acid prevented the production of 2-hydroxyglutarate, reduced methylation of the Foxp3 gene locus, and increased Foxp3 expression. This consequently blocked the differentiation of TH17 cells by antagonizing the function of transcription factor RORγt and promoted polarization into iTreg cells. Selective inhibition of GOT1 with (aminooxy)acetic acid ameliorated experimental autoimmune encephalomyelitis in a therapeutic mouse model by regulating the balance between TH17 and iTreg cells. Targeting a glutamate-dependent metabolic pathway thus represents a new strategy for developing therapeutic agents against TH17-mediated autoimmune diseases.