Ginger (Zingiber officinale) essential oil (ZOE) possesses strong antibacterial and antifungal activities. In this study, the antifungal activity of ZOE against Aspergillus flavus was investigated, and a chemical analysis was carried out to identify compounds that control fungal growth. A total of 37 compounds were identified by gas chromatographic analysis with a mass detector, and the antifungal and antiaflatoxigenic properties of three constituents, γ-terpinene, isoborneol, and citral, against A. flavus were tested. All compounds exhibited strong antifungal activity at 1000 μg/mL, and the antifungal activity of γ-terpinene and citral remained until treatment with tenfold diluted solution. The decrease in aflatoxin production by the three compounds was observed until treatment with 10 μg/mL. To evaluate their antiaflatoxigenic activity, RT-qPCR was used to compare the expression of 11 genes involved in aflatoxin biosynthesis by A. flavus. Among the three compounds, γ-terpinene and citral markedly reduced the expression of most of the tested genes but a different pattern of downregulation of the expression was observed. γ-Terpinene did not downregulate aflR, aflS, and yap, whereas citral did not alter the expression of aflC and aflG. Therefore, γ-terpinene and citral may have the potential to control A. flavus growth and aflatoxin production in agricultural products, including at the storage stage.