They're coated in acids.
Sour candy gets its punch from food acids, mainly citric acid, found naturally in lemons and limes, and malic acid, the acid in green apples. Some candies also use tartaric or fumaric acid. They're mixed into the candy and often dusted on the outside as a "sour sanding" of acid crystals mixed with sugar.
When the acid hits your tongue, it releases hydrogen ions that activate your sour taste receptors. Your mouth responds by producing saliva to dilute and neutralize the acid, and your face often scrunches up. The sugar underneath then balances the sourness, which is why the pucker fades into sweetness.
Extremely sour candies became a craze in the 1990s with brands like Warheads, which carry warnings about eating too many at once.
Because acids can soften tooth enamel, dentists suggest rinsing with water after sour candy and waiting a little before brushing.