Gold is highly associated with Magic.
It is used in crafting Golden Carrots, a food item that gives the most saturation and is the ingredient in brewing a Potion of Night Vision.
It is used in crafting Golden Apples, It and its enchanted variant can give very powerful magical effects when consumed.
It is also used in crafting Golden tools, and although they are fragile and unreliable compared to Iron, Golden tools have the highest chance of acquiring powerful and rare enchantments compared to all other materials.
Why's Gold so associated with magic? Here's what I think is the answer.
It is all based on the Mythology of Magical Beings being vulnerable to Iron. Let me explain.
Iron is extremely useful in both Minecraft and Irl, It is used in crafting weapons, armour, and tools. In game its also used in building Iron Golems and Iron Doors.
And in real life exists Mythologies telling stories about Magical Creatures such as Fairies, Elves, Spirits, and Demons being weak and vulnerable to iron, So much so they refuse to ever use it, Instead opting to use the inferior Bronze and Gold as substitutes in weapon and armour making, To make up for Gold and Bronze's inferiority, These creatures would enchant the items with magic to far surpass even Iron.
Maybe that's the reason why Gold is associated with Magic, maybe its because its all based on the Mythology of Magical Entities using Gold (and Bronze but Bronze isn't in Minecraft) as a substitute to Iron and enchanting their items with magic to make up for its weaknesses.