Because it is.
Despite what we learned in grade school the tongue can discern six (yes, six) tastes.
“Spicy” is not actually a “taste” but a sensation of pain on the papillae of the tongue. Black pepper causes a slight sensation of pain and also sends aromatic compounds into the nasal cavity where black pepper gets its personality.