Hello and welcome to eHealth Forum!
Pain in the chest just under the breast bone can be costochondritis (inflammation of the joint between rib and sternum). The inflammation around the joint area gives sharp pain on taking a breath (as while passing stool). This can also cause tenderness on pressing the area which pains.
The pain can also be due to any inflammatory bowel condition such as as ulcerative colitis, Crohnâs disease, Celiac disease (gluten intolerance), lactose intolerance or IBS or irritable bowel syndrome. However these would also cause other symptoms like loose stools, blood in stools or mucus. It could also be worms in stool.
Start with a stool test. You could first consult an orthopedic specialist and if costochondritis is ruled out then a gastroenterologist. Hope this helps. Take care!