Precious metals such as gold and platinum, but also many other rare and noble metals, largely originated within neutron star collisions - collisions between exceedingly heavy massive and dense remnants of supernovas.  In the final moments of the collision, the physical conditions are so extreme that these heavy rare elements can be formed, and are sprayed into space.  Interstellar dust and gas clouds contain some of these elements, as did the dust cloud from which our solar system formed.  
Those heavy metals fell to the centre of the molten core of earth, and are no longer accessible. However about 200 million years after Earth formed, a late heavy bombardment of meteors impacted earth. As Earth had already begun to cool and solidify, the material (including heavy metals) in that bombardment became part of earth's crust, rather than falling deep into the core. They became processed and exposed by geological processes over billions of years. It is believed that this represents the origin of many elements, and all heavy metals, that are found on earth today.