Bruised ribs are usually a result of a blow to the area. Shove, punch, accident, etc. It's a blunt force injury. Guy's who play contact sports can have this often. It will hurt when you take a breath, raise the arms, change positions sitting, lying or even walking. Though not always, the rib area should change colors. Usually goes away in a few days, if allowed to rest the area.
Could also be a slight muscle, tendon or cartilage tear. (ruling out a cracked rib here, which would be very painful) Any of these can result from working out, though you may not notice it at the time. Even not working out, stretching or reaching for something could cause this. Common nerve damage come to mind also. So best to rest and skip a couple of workout until healed. Good Luck
Side Bar: most athletes I come in contact with use Excedrin extra strength for pain or discomforts. Either before or after a training session (they tell me it's great for hangovers too). Advil, Aleve, etc are OK for the general public but do not seem to cut it for most of the jocks I know. Not recommending anything, may not be good or work for you. Just to say many locker room are never without large bottles of Excedrin.