c. 1300, plural of Middle English galwe "gallows" (mid-13c.), from Old Norse galgi "gallows," or from Old English galga (Mercian), gealga (West Saxon) "gallows;" all from Proto-Germanic *galgon "pole" (source also of Old Frisian galga, Old Saxon galgo, Middle High German galge "gallows, cross," German Galgen "gallows," Gothic galga "cross"), from PIE *ghalgh- "branch, rod" (source also of Lithuanian žalga "pole, perch," Armenian dzalk "pole").
In Old English, also used of the cross of the crucifixion. Plural because made of two poles. Gallows-tree is Old English galg-treow. Gallows humor (1876) translates German Galgenhumor.
"to prance about in a self-satisfied manner," 1871, coined by Lewis Carroll in "Jabberwocky," apparently by blending gallop and triumph. "The sense in current use may vary according to different notions of what the sound expresses" [OED]. Related: Galumphing.