Answer:
Sun isn’t made of coal because the Sun and the Earth through radioactive dating of rocks has been known and confirmed to exist for around billions of years which was before the discovery of fossil fuels such as coal.
It should also be noted that the Sun thermal energy is as a result of the nuclear fusion reactions. Hydrogen atoms fuse to become helium as a result of the strong gravitational force which acts on the Sun.