To gild is to cover something with a thin layer of gold. A guild is an association of craftspeople or professionals. The U marks the organisation, and the phrase is "gild the lily" — no U.
The core difference
A verb about gold and a noun about organisation.
- gild — cover with gold: a gilded frame.
- guild — an association: the Writers' Guild, medieval guilds.
The phrase
Gild the lily means to add unnecessary ornament to something already beautiful. It is a compression of Shakespeare — the original line in King John is "to gild refined gold, to paint the lily", which is a slightly different image. The condensed version is now the standard idiom.
The gilded age
The Gilded Age — the term for late nineteenth-century America — uses the gold sense pointedly: gilded means covered in gold, not made of it. Mark Twain chose it to imply a thin bright layer over something less attractive.