ABSTRACT Gray sufu is a traditional Chinese fermented soybean curd, and its flavor is significantly influenced by bacterial community. In this study, volatile flavor compounds (VFCs) were examined by headspace solid‐phase microextraction (HS-SPME) in conjunction with gas chromatography and mass spectrometry (GC‐MS). Additionally, bacterial community was analyzed using high-throughput sequencing. The results showed that, a total of 156 VFCs were tentatively identified, in which 8 esters, 6 S/N-containing compounds, 3 alcohols, 3 aldehydes, 1 ketone and 3 other compounds were recognized as the main characteristic VFCs. The abundant S/N-containing compounds are the most important flavor characteristics of gray sufu. A total of 4 phyla and 12 genera were revealed as dominant bacteria. Firmicutes and Proteobacteria were the most abundant phylum, whereas Bacillus, Tetragenococcus and Lactococcus were the prevailing genera. According to the KEGG pathway annotation, amino acid metabolism (26.98%) was the highest metabolic pathway. Among them, aromatic amino acids metabolism accounted for the highest proportion, up to 34.94%. Correlation analysis showed that Lactobacillus, Tetragenococcus, Bacillus, Pseudomonas and Halanaerobium were the top five positive flavor-producing bacteria. The results will be helpful for understanding the fermentation mechanism of gray sufu and improving flavor quality by developing microbial regulation strategies.