No, the tail does not always trail the comet. To understand how this can be so, you must first understand what causes the tail of the comet. First, a comet is composed of two parts, the core and the tail. The core is a lump of frozen gas, pebbles, dust, and other interstellar stuff, sometimes described as a large, dirty snowball. This “snowball” travels around the Sun in an elliptical orbit.
That means that the comet travels in a long, narrow oval shaped orbit with the Sun close to one end of the oval. When the comet is far away from the Sun it travels relatively slowly and is extremely cold and frozen. As it continues in its orbit, it eventually returns close to the Sun at an extremely rapid rate of speed, swinging around the Sun and whipping back out to the distant regions of the Solar System again. Some Comets have orbital periods of hundreds, even thousands of years.

Comet Halley
As the comet approaches the Sun, it begins to warm up and give off gases and small particles that form the comet’s tail. These gases and small particles are slowly pushed away from the comet’s core by “solar wind” or the pressure of light shinning from the Sun. As the comet approaches the Sun, its tail will appear to stream behind the comet like a vapor trail of an airplane. On the other hand, as the comet recedes back out into deep space, the comet’s tail will appear to lead the comet, as the tail is pushed along by the sunlight.
In any case, the tail of a comet always streams away from the Sun, on the opposite side of the comet from the Sun. One last point I wish to make here. It is this debris trail left behind the comet’s passing that produces a meteor shower. What happens is, the Earth, moving in its orbit about the Sun, happens upon the comet debris trail and cuts through it. The debris left behind by the comet burns up in the Earth’s atmosphere, producing a meteor shower, as the Earth collides with it.