A hot chili makes your mouth feel on fire, though nothing is burning. A chemical called capsaicin switches on the same nerve sensors that detect real heat.
Birds don't get that signal. Their heat sensors ignore capsaicin, so they gulp chilies down.
Biologists think that suits the plant. The burn keeps away mammals, which grind seeds with their teeth. Birds swallow seeds whole and pass them in droppings far away, still able to sprout.