Aspergillus flavus is an opportunistic fungal pathogen capable of producing aflatoxins, potent carcinogenic toxins that accumulate in maize kernels after infection. To better understand the molecular mechanisms of maize resistance to A. flavus growth and aflatoxin accumulation, we performed a high-throughput transcriptomic study in situ using maize kernels infected with A. flavus strain 3357. Three maize lines were evaluated: aflatoxin-contamination resistant line TZAR102, semi-resistant MI82, and susceptible line Va35. A modified genotype-environment association method (GEA) used to detect loci under selection via redundancy analysis (RDA) was used with the transcriptomic data to detect genes significantly influenced by maize line, fungal treatment, and duration of infection. Gene ontology enrichment analysis of genes highly expressed in infected kernels identified molecular pathways associated with defense responses to fungi and other microbes such as production of pathogenesis-related (PR) proteins and lipid bilayer formation. To further identify novel genes of interest, we incorporated genomic and phenotypic field data from a genome wide association analysis with gene expression data, allowing us to detect significantly expressed quantitative trait loci (eQTL). These results identified significant association between flavonoid biosynthetic pathway genes and infection by A. flavus. In planta fungal infections showed that the resistant line, TZAR102, has a higher fold increase of the metabolites naringenin and luteolin than the susceptible line, Va35, when comparing untreated and fungal infected plants. These results suggest flavonoids contribute to plant resistance mechanisms against aflatoxin contamination through modulation of toxin accumulation in maize kernels.