What is the difference between Astronomy and Cosmology?
Astronomy is observation, cosmology is theory.
Cosmology deals with the large-scale structure and geometry of the universe---its history, how it has evolved. It's overall particle and chemical make-up and how that has evolved. Its age.
Nowadays we have both theoretical and observational cosmology. One of the main reasons for putting up the Hubble Space Telescope was to accurately determine the expansion rate. And other cosmo parameters. Measuring a largescale parameter, like overall curvature or expansion rate would be observational cosmology.
An astronomy department at a university will typically have some people who do cosmology (study the overall shape and history of the universe) and some people who do astrophysics (how stars form, how they change with time, how they explode, how quasars work, what makes cosmic rays etc etc.)
Nowadays you get both theoretical and observational astrophysics---theory means making mathematical models (of a star for example) and observation means checking models against reality to see if they match.
And as I said you also get both theoretical and observational cosmology. A big input to observational cosmology is the mapping of the CMB (cosmic microwave background) and also the galaxy-counts or redshift surveys, where they count how many galaxies there are at various distances to detect large scale undulations in the concentration of matter. Obs. cosmo people look for very largescale patterns, largescale structure and try to model how it formed, and what it says about the fluctuations and expansion in the early universe.
As marcus said there are both theoretical and observational astronomers and cosmologists (with many people somewhere in between in both the theory-observer as well as astronomer-cosmologist spectrum).
The way I would put it is that an astronomer generally wants to look at some class of objects to learn about them for the sake of learning about them. So an astronomer working on stars will use telescopes to look at them and/or do theoretical modelling of them with the end goal to understand more about stars. The same applies to people who study galaxies, pulsars or whatever.
On the other hand, cosmologists need to use the enormous wealth of knowledge that astronomers have built up about the nature of the objects (stars, galaxies etc) in the Universe, but they use that knowledge to address broader questions about the Universe. There is a lot of overlap though, for instance to use galaxies to do cosmology, you need to do a lot of detailed thinking about the nature of galaxies, and hence simulations or observational surveys are often done with large groups of people, some of whom are ultimately wanted to study the galaxies themselves, while others just want the galaxy bit to be understood so they can use the results to infer things about cosmology.
On the other hand, you often have to assume a cosmology when you want to say something about for instance the evolution of galaxies. The two go hand in hand and it is somewhat a case of one person's noise is another signal...
Isn't that the difference between astronomy and astrophysics???
The lines are blurred, as Marcus and Wallace noted. Astronomy has historically been regarded as the observational arm of cosmology and astrophyics. But, both cosmologists and astrophysicists have been known to peek through a scope every now and then to test their ideas. Many cosmologists and astrophysicists, however, have never set foot in an observatory.
Separate names with a comma.