Interleukin-17 (IL-17)-producing helper T (TH17) cells are heterogenous and consist of nonpathogenic TH17 (npTH17) cells that contribute to tissue homeostasis and pathogenic TH17 (pTH17) cells that mediate tissue inflammation. Here, we characterize regulatory pathways underlying TH17 heterogeneity and discover substantial differences in the chromatin landscape of npTH17 and pTH17 cells both in vitro and in vivo. Compared to other CD4+ T cell subsets, npTH17 cells share accessible chromatin configurations with regulatory T cells, whereas pTH17 cells exhibit features of both npTH17 cells and type 1 helper T (TH1) cells. Integrating single-cell assay for transposase-accessible chromatin sequencing (scATAC-seq) and single-cell RNA sequencing (scRNA-seq), we infer self-reinforcing and mutually exclusive regulatory networks controlling different cell states and predicted transcription factors regulating TH17 cell pathogenicity. We validate that BACH2 promotes immunomodulatory npTH17 programs and restrains proinflammatory TH1-like programs in TH17 cells in vitro and in vivo. Furthermore, human genetics implicate BACH2 in multiple sclerosis. Overall, our work identifies regulators of TH17 heterogeneity as potential targets to mitigate autoimmunity.