Community genetics aims to understand the effects of intraspecific genetic variation on community composition and diversity, thereby connecting community ecology with evolutionary biology. Thus far, research has shown that plant genetics can underlie variation in the composition of associated communities (e.g., insects, lichen and endophytes), and those communities can therefore be considered as extended phenotypes. This work, however, has been conducted primarily at the plant genotype level and has not identified the key underlying genes. To address this gap, we used genome‐wide association mapping with a population of 445 aspen (Populus tremuloides) genets to identify the genes governing variation in plant traits (defence chemistry, bud phenology, leaf morphology, growth) and insect community composition. We found 49 significant SNP associations in 13 Populus genes that are correlated with chemical defence compounds and insect community traits. Most notably, we identified an early nodulin‐like protein that was associated with insect community diversity and the abundance of interacting foundation species (ants and aphids). These findings support the concept that particular plant traits are the mechanistic link between plant genes and the composition of associated insect communities. In putting the “genes” into “genes to ecosystems ecology”, this work enhances understanding of the molecular genetic mechanisms that underlie plant–insect associations and the consequences thereof for the structure of ecological communities.