When William Herschel wrote his catalogue of deep sky objects, he used the name "spiral nebula" for objects like the Andromeda Galaxy. 200 years later astronomers discovered that they are made of stars as the Milky Way is, so the term 'nebula' is now only used for diffuse structures within a galaxy.