You remember that hot thing you touched that burnt your finger/hand/arm etc? And you avoided doing it again? That's why pain is useful.
I'm no evolutionary biologist but I'd imagine that the ability to feel pain was an evolutionary benefit to our ancestor's survival (avoidance of dangerous activities) long before we differentiated into our own species.
I'd actually love to read the thoughts/findings/knowledge of an actual evolutionary biologist on this.
Just thought I'd edit this to add that more serious injuries like breaking a bone are probably more painful to incite more fear in conducting the activity that led to the injury in the first place. It's risk vs reward behaviour; if there's little risk of pain, and a high chance of reward then you're going to want to do the task at hand, but if there's a higher risk of pain and therefore injury, then you'll be less likely to carry out such behaviour.
It's also possible that pain could have played a role in rinsing the gene pool of defective genes. If a person is likely to be in pain for most of their life due to poor genetics, then that makes them less likely to live longer and therefore less likely to produce offspring, thus ridding their genes from the gene pool.
Interesting topic this, OP. I commend.