Aflatoxin-affected groundnut or peanut presents a major global health issue to both commercial and subsistence farming. Therefore, understanding the genetic and molecular mechanisms associated with resistance to aflatoxin production during host–pathogen interactions is crucial for breeding groundnut cultivars with minimal level of aflatoxin contamination. Here, we performed gene expression profiling to better understand the mechanisms involved in reduction and prevention of aflatoxin contamination resulting from Aspergillus flavus infection in groundnut seeds. RNA sequencing (RNA-Seq) of 16 samples from different time points during infection (24 h, 48 h, 72 h and the 7th day after inoculation) in U 4-7-5 (resistant) and JL 24 (susceptible) genotypes yielded 840.5 million raw reads with an average of 52.5 million reads per sample. A total of 1779 unique differentially expressed genes (DEGs) were identified. Furthermore, comprehensive analysis revealed several pathways, such as disease resistance, hormone biosynthetic signaling, flavonoid biosynthesis, reactive oxygen species (ROS) detoxifying, cell wall metabolism and catabolizing and seed germination. We also detected several highly upregulated transcription factors, such as ARF, DBB, MYB, NAC and C2H2 in the resistant genotype in comparison to the susceptible genotype after inoculation. Moreover, RNA-Seq analysis suggested the occurrence of coordinated control of key pathways controlling cellular physiology and metabolism upon A. flavus infection, resulting in reduced aflatoxin production.