A comet generally has two tails, not one. One tail is due to the comet’s dust particles, the other is due to ionized gas from the comet coma.
Dust particles form the first tail. This comet tail generally points back along the comet path (so if the comet is traveling right, the dust tail extends to the left).
Ions (electrically charged particles), which first come from the nucleus as (neutral) gaseous particles, are swept into the second comet tail. Because of the special interaction with the Sun’s magnetic field, this tail always points directly away from the Sun.
source : windows to the universe