I can't quite piece together the whole story, but it seems to stem from an obsolete slang sense of the word mud meaning 'fool' which came from Memoirs Right Villanous John Hall (1708), and was later cited as follows:
1823 ‘J. BEE’ Slang 122 Mud a stupid twaddling fellow. ‘And his name is mud!’ ejaculated upon the conclusion of a silly oration, or of a leader in the Courier.