Because gold, silver, etc. have qualities that make them desirable for trade. Theme portable, durable, capable of being denominated in values that make trade possible, etc. If two parties want to trade food or services, the food could spoil in transit, the services might not be agreed upon...