They are caused by magnetic activity in which the specific area cooler than the area around it, showing a difference in colour. Usually 1000 degrees celsius difference.
Interesting fact: sunspots are not dark, they are in fact quite bright. They only appear dark due to an optical illusion. If you were to shine a searchlight on a wall, then hold a lightbulb (turned on of course) in front of the searchlight, it would in fact appear dark on the wall, much as a sunspot does.
Why does the sun have dark spots on it (sunspots)?
The Sun contains a chaotic tangle of flux tubes. Sometimes a section of a large flux tube expands and rises through the sun's "surface." This creates two sun spots of opposite polarity. The spots move apart as the tube continues to rise and expand, moving toward the poles to which they are attracted. Eventually the flux tube will arrive at said poles, weakening the magnetic field. After 11 years the field is weakened enough that it reverses.
The spots are dark since 1) the material in the interior of the flux tube mixes slowly with the remainder of the sun, and 2) the risen section of the flux tube acts as a radiator, which cools the interior, and 3) cooler material is darker.
Sunspots are cause by the large magnetic field of the Sun. Note sunspots appear darker because they are cooler than the surrounding material.
You would expect that having more sunspots, would mean the Sun is less bright/luminous, this isn't true, what is observed is that when there are more Sunspots, the brightness/luminosity of the Sun actually increases because the areas around sunspots are hotter than average.