Why does my penis hurt after having sex?

Trauma. Most commonly, during sex, too much friction causes sores or small cracks in the skin or even small trauma to the urethra. The penis needs to heal. In the meantime, keep it clean and dry. Watch for infection (redness, swelling, increased or different pain), etc. Sometimes a soothing lotion will help. In the future, use more lubrication, extend foreplay to increase lubrication, etc.