its natural
When you have nowhere to go with emotional pain and distress its entirely natural to 'do' something to relieve it.
Your self-position will dictate the 'what' you do. If you feel 'bad' as a result of emo pain/distress there is greater likelihood that you will turn the pain inwards and express it through physical harm, which is a release from the emo/pyschological pain you feel.
We also work on many levels of 'satisfying needs' and these often get mixed, so eating definitely satisfies a major driving need within us, that gets derailed and diverted sometimes into doing something to alleviate [boredom/pain], and becomes a habit, that can be unlearned but needs to be supplanted with something else more helpful?
Pain so intense can be hard to not be overwhelmed in this way, but thinking around the issue, and suggesting to yourself those ways that are making you feel better in a positive helpful way, non-harmful way, start you protecting yourself and acting.
Sharing it on here is good because it removes the shame, saying it out loud helps stop the internalising. There is a trend at the moment amongst CBTer's [I think] to use bands around wrists to flick yourself each time you feel this way.
So, basically, hurt yourself????? I have challenged this and feel wholely against any such practice.
Nurture, kindness and self-soothing are the practices to supplant the harmful. The ways of nurturing/kindness & soothing are of your own choice.
I recently bought my teen son a massive really fluffy blanket, which has a male theme on it. He self-harms by banging his head against a wall/floor/nearest object/own hands when meeting a boundary that he can't face because it conflicts with supporting another belief in him. I found him this way one way and wrapped the blanket around him and held him, then left him quietly whilst he stayed in the blanket himself. He sleeps in the blanket and wraps himself in it when he feels challenged this way. Its not a teddy bear, or any of the traditional things that are so easy for women /girls to use for soothing without notice. It just what works for you.
Once the pain has subsided and calm has returned it might be worth noting what brought up the pain, and what challenges to self were involved in that.