Many things. Among them, your rib could be broken.
You could have an infection. The pain could come from something other than your rib. Cancer
might do it. Pain from the lung, heart
, sternum, liver, spleen, diaphragm... Maybe a more specific question could be better answered here.