Why do comets have tails?
Comets develop tails as they approach perihelion—the place in their orbits when they are closest to the Sun. The Sun’s heat vaporizes some of the comet's material, releasing dust particles that were trapped in the ice.
A combination of solar radiation pressure and solar wind blow away gas and dust from the comet’s nucleus, forming two separate tails: the ion tail and the dust tail.
Two Types of Tails
Ultraviolet light ionizes the neutral gas blown off the comet, and the solar wind carries these ions straight out from the Sun to form the ion tail, which typically glows blue. The dust tail on the other hand is neutral, composed of small dust particles (similar in size to those found in cigarette smoke). Pressure from the Sun's radiation pushes these particles away from the comet’s nucleus. These particles continue to follow the comet’s orbit around the Sun, and form a diffuse, curved tail that typically appears white or pink from Earth.
Comets aren't the only objects in the solar system with tails — recent observations show that even asteroids can sprout dust tails on occasion.