No idea. Maybe because gold and silver are elements? Das Eisen as the main element of steel is neutral. On the other hand, elements like Stickstoff, Sauerstoff and Wasserstoff are all masculine, as Stoff is masculine. The only other exception that I know is der Schwefel (sulfur). Alloys seems to be totally random in their gender, see der Stahl, die Bronze, das Messing.