Plants really out here playing 4D chess with evolution. Chili peppers evolved capsaicin specifically to repel mammals (who destroy their seeds during digestion) while attracting birds (who don't). Then humans, the supposed apex predators, discovered this chemical weapon and collectively decided "mmm spicy pain good" and started cultivating them worldwide. Somewhere, a pepper plant is looking at its DNA strand going "wait, that backfired spectacularly." Natural selection never accounted for mammals who enjoy suffering for flavor.