Aflatoxin, a carcinogenic secondary metabolite produced by Aspergillus flavus, is a significant threat to human health and agricultural production. Histone 2-hydroxyisobutyrylation is a novel post-translational modification that regulates various biological processes, including secondary metabolism. In this study, we identified the novel histone 2-hydroxyisobutyryltransferase Afngg1 in A. flavus, and explored its role in cell growth, development and aflatoxin biosynthesis. Afngg1 gene deletion markedly decreased lysine 2-hydroxyisobutyrylation modification of histones H4K5 and H4K8 compared with the control strain. Additionally, Afngg1 deletion inhibited mycelial growth of A. flavus, and the number of conidia and hydrophobicity were significantly decreased. Notably, aflatoxin B1 biosynthesis and sclerotia production were completely inhibited in the ΔAfngg1 strain. Furthermore, the pathogenicity of the ΔAfngg1 strain infecting peanut and corn grains was also diminished, including reduced spore production and aflatoxin biosynthesis compared with A. flavus control and Afngg1 complementation strains. Transcriptome analysis showed that, compared with control strains, differentially expressed genes in ΔAfngg1 were mainly involved in chromatin remodelling, cell development, secondary metabolism and oxidative stress. These results suggest that Afngg1 is involved in histone 2-hydroxyisobutyrylation and chromatin modification, and thus affects cell development and aflatoxin biosynthesis in A. flavus. Our results lay a foundation for in-depth research on the 2-hydroxyisobutyrylation modification in A. flavus, and may provide a novel target for aflatoxin contamination prevention.