As a child, I used to hear:
"Stop crying or I'll give you something to cry about."
So, I sulked for days in my room, feeling very alone with the anger, frustration and upset with no tools for releasing the emotions.
As an adult, I was able to ask my dad about his reaction and why he thought that was going to help the situation. His response was that he didn't know what else to do.
You may have experienced something like that, too, and as a result, learned to repress your emotions and automatically push them away. Your brain may have decided that it was not safe to feel a specific emotion and created a fear response when that emotion comes up.
Emotions can become trapped in the body - anywhere - and the result is often feeling physical pain in your body. One way of identifying what you are feeling is to ask yourself how you feel when you are in pain. You may feel lonely, rejected, guilty, discouraged, etc. The answer to the question may be the discovery of the emotion that has been repressed.
Some resources that may help with understanding what the pain in your body is telling you:
The Secret Language of Your Body by Inna SegalFeelings Buried Alive Never Die by Karol K. Truman
Instant Emotional Healing by Peter Lambrou, Ph.D. & George Pratt, Ph.D.
The Emotion Code and The Body Code - Dr. Bradley Nelson