The correct answer is: the solar wind.
The tail of the comet is composed of the material from the comet that gets released as the comet gets closed to the sun. The solar wind then causes this material to "blow away" from the comet, causing the visual effect of a "tail".