Hello and welcome to e health forum.
The probable condition you might be having is costochondritis associated with viral infection.
Costochondritis is inflammation of the junctions where the upper ribs join with the cartilage that holds them to the breastbone or sternum. The condition causes localized chest wall pain and tenderness that you can reproduce by pushing on the involved cartilage in the front of the rib cage. Most cases of costochondritis have no apparent cause, and they usually subside spontaneously without treatment.
The cause of diarrhea in your case, is probably due to the viral infection, and not a direct effect of costochondritis. You may get relief from the loose stools by using OTC antidiarrheals like imodium or loperamide.
Taking medications like Ibuprofen (Advil, motrin) can help in relieving the pain associated with costochondritis. In case, they do not help, you may need treatment with prescription medications like antidepressants to control the pain.