When a comet is in the inner Solar System, the Sun warms it up, causing the comet's ice to vaporize and release dust and gas particles. The solar wind blows those particles off the comet, and we see the dust and ion tails.