Chemical compounds are highly important in the ecology of animals. In social insects, compounds on the body surface represent a particularly interesting trait, because they comprise different compound classes that are involved in different functions, such as communication, recognition and protection, all of which can be differentially affected by evolutionary processes. Here, we investigate the widely unknown and possibly antagonistic influence of phylogenetic and environmental factors on the composition of the cuticular chemistry of tropical stingless bees. We chose stingless bees because some species are unique in expressing not only self-produced compounds, but also compounds that are taken up from the environment. By relating the cuticular chemistry of 40 bee species from all over the world to their molecular phylogeny and geographical occurrence, we found that distribution patterns of different groups of compounds were differentially affected by genetic relatedness and biogeography. The ability to acquire environmental compounds was, for example, highly correlated with the bees' phylogeny and predominated in evolutionarily derived species. Owing to the presence of environmentally derived compounds, those species further expressed a higher chemical and thus functional diversity. In Old World species, chemical similarity of both environmentally derived and self-produced compounds was particularly high among sympatric species, even when they were less related to each other than to allopatric species, revealing a strong environmental effect even on largely genetically determined compounds. Thus, our findings do not only reveal an unexpectedly strong influence of the environment on the cuticular chemistry of stingless bees, but also demonstrate that even within one morphological trait (an insect's cuticular profile), different components (compound classes) can be differentially affected by different drivers (relatedness and biogeography), depending on the functional context.