Fresh or frozen pineapple contains an enzyme called bromelain that breaks down gelatin, which is the main component of Jell-O. Gelatin is primarily from a structured protein called collagen, which is extracted from bones and connective tissues of animals. Since the bromelain in fresh pineapple can digest the protein, the gelatin in Jell-O will not be able to set when mixed with it.
Gelatin has been around since the 1400s, served as a dessert even then. American inventor Peter Cooper, who was also credited with building the first steam-powered locomotive, patented the powdered gelatin in 1845. The Jell-O brand was trademarked by Pearle Bixby Wait in 1897 in LeRoy, New York, where the only Jell-O Museum in the world is located as of 2015.
Apart from fresh pineapple, other fruits such as papaya and kiwi, as well as ginger root, also contain an enzyme that will prevent the gelatin in Jell-O from setting. The ability of bromelain in pineapple to break down protein makes it a natural meat tenderizer. Some commercial meat tenderizers even contain bromelain.
Pineapple, however, can still be added to Jell-O recipes as long as it is processed and not fresh. This is because processed pineapples are cooked and heat breaks down the enzyme bromelain, effectively neutralizing its ability to digest collagen.