To writhe (verb): to twist, wring, or contort (a part of the body)
From the Proto-Germanic *wrīþaną, meaning twist or turn.
Agony (noun): extreme mental or physical suffering, particularly that of Jesus Christ in the Garden of Gethsemane.
Derived from the Greek agonia, meaning struggle for victory, or in a more general sense, exercise or gymnastics.
Evolution of meaning to include sense of pain so severe as to cause struggling occurred around the turn of the 17th century.