Comets are made out of rock and ice, looking like dirty snowballs in space. The ice alone, is not only made of water, but also carbon dioxide, methane, and other things. As a comet approaches the sun, it melts and leaves behind bits of rock to orbit the sun. Soon earth will collide with its orbit and meteoroids and meteors form.
I really hope this helps!