Because any blockage in your intestine whether food or wind will cause your intestine to try to push the blockage through, as it’s blocked and can’t get through it causes pressure which leads to pain.
I suffer from occasional blockages in my gut due to post operative adhesions from a burst appendix, very, very painful, I use Mebeverine, it’s an over the counter ( with caveats) anti spasmodic medication which prevents your stomach muscles pushing quite so hard and helps me enormously, obviously talk to a medical professional first but I’m sure there’ll be something that can help ease the condition until it clears itself.