Traditionally the difference between comets and asteroids is simple. Comets form tails of gas and dust when they are near the Sun, and asteroids do not. But as we’ve learned more about asteroids and comets we’ve found that things aren’t as clear cut.
Comet tails are produced when “volatiles” such as water ice on the comet’s surface are sublimed by the Sun’s heat. This means comets must have surface ice, leading to the idea that they are “dirty snowballs.” Asteroids, on the other hand, were seen as dry rocky bodies, hence their lack of tails. On a basic level that’s true, and comets do tend to be more icy than asteroids. But comets can be quite rocky in composition, and asteroids can have plenty of icy volatiles. So sometimes a comet can appear much like an asteroid and an asteroid can have a comet-like tail.
A good example of this can be seen in the asteroid P/2016 J1. It was discovered in 2016 by Pan-STARRS, and was found to have two separate components (called A and B). These two objects have extremely similar orbits, meaning that they were once a single asteroid that was broken in two by a collision or gravitational interaction. Computer simulations of their orbits show that the asteroid likely split apart about six years ago. That would make it the youngest fragmented asteroid we know.
P/2016 J1 is in the asteroid belt, taking about 5.5 years to orbit the Sun. At its closest approach (perihelion), the asteroid is about twice as far from the Sun as Earth. Last year when it was near perihelion, the two parts of the asteroid started to become active and produced long dusty tails. In other words they looked like comets. This was probably caused by ice that was exposed by the fragmentation. Once heated by the Sun, they started to sublime and created the tails we could observe.
This doesn’t mean comets are simply broken asteroids. What it does demonstrate is that the interiors of asteroids can have lots of icy volatiles. They are just hidden by an asteroid’s the rocky exterior. So comets and asteroids can’t easily be divided into dirty snowballs and dry rocks. Instead it is more a matter of degree. Asteroids and comets are far more similar than we once thought.
Paper: Fernando Moreno, et al. The splitting of double-component active asteroid P/2016 J1 (PANSTARRS). arXiv:1702.03665 [astro-ph.EP] (2017)