Think about the aroma released when you start to peel an orange . . . many people might like the smell, but not whiteflies. The odour comes from limonene, a volatile organic compound found in certain plants, including citrus (particularly the peels) and marigolds. Limonene is the active ingredient responsible, at least in part, for the pest-repellent properties of marigolds.
Planting marigolds among vegetables is a traditional form of pest control. British scientists found that interspersing marigolds among tomato plants in greenhouses reduced the incidence of whitefly, a common greenhouse pest. Whiteflies were repelled by both the leaves and flowers of the marigolds, with the flowers having double the amount of limonene and a greater repellent effect. The researchers compared the effect of the plants to that of dispensers releasing the chemical limonene and found the plants were a more powerful repellent.
The key to using marigolds is to plant them from the start. When marigolds were moved into the greenhouse after a whitefly infestation was in progress, they had only a minimal effect. Dispensers were more effective in this case.
Source: Conboy, NJA, T McDaniel, A Ormerod, et al. Companion planting with French marigolds protects tomato plants from glasshouse whiteflies through the emission of airborne limonene. PLOS ONE, 2019; 14 (3): e0213071 DOI: 10.1371/journal.pone.0213071
— Janet Wallace