Old Irish of unknown origin. The Welsh Madog (Old Welsh "fortunate, good") is a probably a surviving variant.