Peppers have been cultivated by humans for over 9000 years and birds have been eating their spicy ancestors for even longer. Peppers are from the nightshade family of the Genus Capsicum, they are related to tomatoes, okra, and eggplant.
All peppers are naturally spicy, humans over the past 9000 years through selective breeding have bred what we now call ‘sweet peppers’ from their spicy ancestors.
Peppers are self pollinators, but get some help from bees. When sweet peppers are planted in close enough proximity to hot peppers the genetics will mix, resulting in the next generation in a hybridized pepper variety with the potential to create mild hot peppers and spicy sweet peppers. Maintaining genetic purity is near impossible for seed saving farmers with limited space, but can be done with proper proximity 50ft- ¼ of a mile and barrier crops. Even with these practices in place, outside, unknown, or misunderstood variables play a role that leads to variation.
This doesn’t commonly happen with store bought peppers because those farmers practice monoculture – planting 1 type across large areas – an environmentally damaging practice, though economically a lot more attractive. Polyculture allows cross-pollination that occasionally results in a surprise spicy pepper.