Mercury's tail consists of surface particles ejected by micrometeorites
Professor of Planetary Science Paul Byrne explains that what we see in this photograph by the astrophotographer Sebastian Voltmer is not a comet but Mercury.
The reason it has a tail is that micrometeorites bombard the planet's surface and throw tiny fragments of it out into space. These fragments contain atoms that go to make up minerals, sodium for example, which glows when sunlight falls on it. Thus the thin, comet-like glowing tail is in essence a trail of pieces of Mercury.