A lot of carbon is made in stars and collects in dust clouds that condense into objects.
Close to the sun volatile substances such as hydrocarbons and water got cooked off so the Earth is still a dry place rich in aluminum and silicon compared to objects outside the frost line (Jupiter) which tend to have water, carbon dioxide, and hydrocarbons as major components.