Painful sex (or dyspareunia) can happen for a whole range of reasons, including:
Endometriosis, adenomyosis, pelvic floor dysfunction, interstitial cystitis, fibroids, pelvic inflammation, pelvic floor muscle spasm (vaginismus), menopause (genitourinary syndrome of menopause, or gsm), cancer treatments (including chemotherapy and radiation therapy), chronic vulvar pain (vulvodynia), post-surgical vaginal swelling, postpartum pain / sex post baby