You might be thinking of comets. Comets are made of ice and dust, and they do have tails. The tails are formed when the comet gets close to the Sun and the ice starts to vaporize. The vaporized gas and dust are then pushed away from the comet by the solar wind, creating the tail.