Comets shine because they get warm when they go near the sun. Imagine you're wearing a cloak made of ice and dirt, that's what a comet is like. When it gets close to the sun, the ice starts to melt and turns into gas, which creates a glowing tail that we can see from Earth.