From Proto-Celtic*wodwos(“spoils”), whence also Old Irishfodb(“spoils”), from the practice of counting captives as "so many necks".[1]*wudwos may be related to Proto-Celtic*wodwo-(“cutting”) (whence Old Irishfodb in the sense of "division"), with semantic shift "cutting" > "weapon" > "weapon-spoils" > "spoils" (though these shifts are not straightforward). If so, then the root ultimately goes back to Proto-Indo-European*wedʰH-(“strike”), whence gwasgu(“to press”), Lithuanianvedegà(“a kind of axe”), Sanskritवध्(vadh, “to strike, slay”), Tocharian Awac(“struggle”).[2]
The variant gwddwg is cognate with Old Bretonguodoc (Middle Bretongouzouc, Bretongouzoug, goûg), but it is difficult to explain the alternation between -wg, -w, and -f. The oldest form of the word cited in Geiriadur Prifysgol Cymru is the Middle Welsh plural form gedueu (13th century; = modern gyddfau), while the soft mutation forms wðwc, wddf, and wddw are all attested in the 14th century, indicating that the alternation is very old.
^ R. J. Thomas, G. A. Bevan, P. J. Donovan, A. Hawke et al., editors (1950–present), “gwddf”, in Geiriadur Prifysgol Cymru Online (in Welsh), University of Wales Centre for Advanced Welsh & Celtic Studies