Why would I want to raze a city?

Solution 1:

Cities are not free.

Each city you add to your empire increases costs by (I can't remember exactly which of these is right, maybe 2/3?) increasing general maintenance costs, increasing the cost of governments, or raising inflation. One of the costs at least is dependent on how far (unit travel wise) your cities are from your capital. Because of increasing costs, its possible to send your empire into an economic depression by expanding too quickly.

Some cities add nothing to your empire.

Early in the game you might take over a barbarian city. Barbarian cities spawn where no one else is, like Tundra, Jungle, and Desert. There's a reason no one else settled there yet, those cities just won't be worth your civilization's hard earned money or even your time controlling them.

Some cities are too dangerous.

Perhaps Egypt is on the way to a cultural victory, and you decide to stop them by taking their capital. Is that one city late in the game really worth the chance of Egypt getting it back and finishing their 3 legendary cities? Burn it to the ground.

Solution 2:

Adding to the accepted answer:

Some cities are not worth defending

If you're in the middle of an ongoing war, you might not want to spread your troops across multiple captured cities. You might want to keep them together to march on the next city. In that case, leaving behind an undefended or thinly defended city just creates a strong risk that the enemy will take it back, undoing all your hard work.

Some cities are badly placed

The opposing civ might have placed the city in a way that doesn't take advantage of nearby resources, but will interfere if you build another city nearby to get those resources. For instance, maybe the sweet spot for the resources you want would be exactly one tile to the west, but you can't have two adjacent cities. Burn it and send out a settler to build a city in the right damn spot, this time.