The theory is simple: fruit and vegetables (and grains and milk, but fermenting those is more complex) contain natural bacteria which, when deprived of air, can inhibit the growth of microbes that would otherwise spoil them. They do this by converting the carbohydrates and sugars in the food to an acid, in which pathogens and other microbes struggle to thrive.
This gives fermented foods and drink their distinctive tang, as well as the famed probiotic qualities fuelling their popularity. Yet buying them isn’t cheap; at Ocado, for example, a 250g tub of kimchi costs £5.