When the Israelites came out from Egypt, they plundered the Egyptians. YHWH has told Moses before that ‘each woman shall ask of her neighbor, and any woman who lives in her house, for silver and gold jewelry, and for clothing.’ (Exo 3. 22) And, indeed, before the first Passover night, YHWH re-iterated the command to Moses to ‘speak now in the hearing of the people, that they ask, every man of his neighbor and every woman of her neighbor, for silver and gold jewelry.’ (11.2) And ‘the people of Israel had also done as Moses told them, for they had asked the Egyptians for silver and gold jewelry and for clothing.’ (12.35) The Israelites basically plundered the Egyptians when they came out from Egypt.
But what were they supposed to do with the gold? Well, positively, YHWH told Moses that he should collect the gold from the Israelites (25.1-9) and that it would be used to overlay the ark of the covenant (25.10-22), the mercy seat (25.23-30), the lampstand (25.31-40), the Tabernacle (26.1-37), the garments of the priests (28.1-43), and the altar (30.1-10). Well, that’s a lot of things to cover, isn’t it? In essence, for the organization of worship, since gold symbolizes the divine (cf. Rev 21).
On the other hand, negatively, YHWH also told them what not to do with the gold. That is, “You shall not make gods of silver to be with me, nor shall you make for yourselves gods of gold.” (20.23) Yes, gold symbolizes the divine, but specifically it must be used only for YHWH and not for other gods. Monolatry is implied in the use of gold.
Now, guess what did the Israelites do with the gold? Sadly, the negative one. The people saw that Moses delayed to come down from the mountain, and they became agitated. They don’t know what has become of him, so they asked Aaron to make them gods who shall go before them. So Aaron responded, “Take off the rings of gold that are in the ears of your wives, your sons, and your daughters, and bring them to me.” (32.1-2)
And so all the people took off the rings of gold that were in their ears and brought them to Aaron. And he received the gold from their hand and fashioned it with a graving tool and made a golden calf (did the calf represent Apis, an Egyptian bull-deity?). And they said, “These are your gods, O Israel, who brought you up out of the land of Egypt!” (32.3-5)
Well, at least they got the point that the gold was supposed to be used for something related to worship. Although, unfortunately, they got it totally wrong.
Indeed, Moses said that the Israelites have done precisely what YHWH had told them not to do: “Alas, this people has sinned a great sin. They have made for themselves gods of gold.” (32.31)