Pain is a complicated experience. Our skin and muscles sense it, just like they sense softness or warmth. But unlike other sensations, the experience of pain is distinctly unpleasant.
Pain has to hurt for us to pay attention to it, and avoid hurting ourselves further.
But for people in chronic pain, the pain has largely lost its purpose. It just hurts.
While it has long been understood how nerves signal pain to the brain, scientists haven't known how the brain adds a layer of unpleasantness.