https://www.thetimes.co.uk/article/can-cursing-increase-strength-damn-right-ptnxqt067?shareToken=2a3cb323eda66cbd8bdeba2781e1edab
My feeling is that it's probably partly/largely that when we swear or are riled up we have an adrenaline rush, flight or flight and the body gives us extra strength at times like those... With the ability to withstand pain longer I'd think that again partly adrenaline but also partly distraction... while you are thinking up insults you are probably distracted from the pain