The image above is that of the Shoemaker-Levy 9 comet fragments. In 1994, the fragment struck the "surface" of Jupiter, causing scars the size of Earth. Comets are large chunks of ice and rock that are floating in space. Just like asteroids, comets do not have natural tails, but when one approaches a sun, the ice begins to melt and pocketed gas is released. The sun's solar wind then pushs that gas away. That forms the very familiar tail.
Both comets and asteroids are weak enough to be torn apart by the gravity of a planet or star. As the example of the Shoemaker-Levy 9 shows, the tidal forces of Jupiter's gravitational field literally pull the comet apart, forming the string.