Originally the planetary acretion disc. There was a school of thought that some might have come from comet crashes, but I don't think that's popular these days. Essentially everything that is on Earth now (with minor exceptions for meteorites and other collisions) has been here since the planet was formed. The mix of materials on planets varies as you get further out in the solar system, but most have at least some heavy and some light materials