The heavy and rare elements can be produced in Supernova; things like Gold, Platinum, etc. There are other ways, but precisely how isn't important.
But, they can produce them in massive quantities; then heat, explosive forces and gravity can "refine" them to some extent, sorting them by molecular weight. So you can have something like asteroids made entirely of these heavy metals; or even primarily one, like Gold. The Gold on the surface of earth most likely arrived by such asteroids; because any that was present during the planets early molten formation likely sank toward the core.
One planet in the solar system, or even in a large region of solar systems, might be the lucky recipient of such a treasure (gold, platinum, uranium, osmium, etc, see the link above).
Probes might be able to sense the presence of such heavy metals, and as a result the miners are stuck with wherever it might have landed, whether that is Earth-sized or Jupiter-sized, as hot as Mercury or cold as Pluto.
Added to address comment: Here is a Harvard study (from 1956, but still relevant) discussing the predominance of elements in Stars, in Terrestrial abundance, and in meteorites (see pages 187, 192, 194). It is simply untrue that it would be better (more cost effective or easier) to mine common asteroids than it would be to mine a large planetary deposit of some rare metal. Gold in asteroids has a concentration of about 1 part per 20 million; while the top gold mines earth are rated in the 25 to 44 g/t (grams per metric ton [which is 1 million grams]), so 25 to 44 parts per million: That is 500 to 900 times greater concentration than one might find in asteroids.
This is one contributing factor supporting the hypothesis of a gold-heavy asteroid; plus the concentration of high yield gold mines is primarily in Africa: suggesting a rather localized event (or events, if the asteroid broke up) deposited the gold in spots after the formation of the planet; it is not a uniformly distributed element.
For the purposes of a story, there is no reason this could not be amplified; that the miners are specifically seeking extremely high concentrations of precious heavy metals that have some commercial utility. It would be plausible for them to look at rocky planets and moons that might have captured such asteroids in the last few billion years; and somewhat preserved the deposits where they landed. It would be easier than testing billions of asteroids that are probably worthless, and easier than processing 1000 or 2000 times the mass in asteroids looking for some atoms of gold or uranium or osmium or whatever they are seeking. They might not even have the technology to extract a milligram or microgram of an element from a one tonne rock; they may require a higher concentration to make it worth their time and effort (just like our modern day gold miners do).
Finally, they may have far more efficient and cheap means of getting on and off planet; like fusion engines that cost effectively zero. Energy is generally not a problem in space, stars generate plenty of it. They could have huge solar generators in space that beam all the energy they need down to the surface in the form of gamma ray lasers or something. And once they finish mining, they only need to get the product out of the gravity well, not the million tonnes of rock they crushed. The robots they are using to do the mining may weigh far more than the final product they extracted, particularly for very rare elements. And again, the energy needed could be absolutely free to them; captured from the star (even we humans know how to do that IRL).