Agricultural insect pests seek out familiar scents to find their plant hosts. However, they can also be repelled by odors from other plant species.
source https://www.lifetechnology.com/blogs/life-technology-news-blog/garlic-on-broccoli-a-smelly-approach-to-repel-a-major-pest