I'm planning a trip and I see the term "tourist tax" littered about. My question is why do countries/cities tax tourists when tourism in itself is of economical benefit to the country?
Because they can.
Not all tourists spend money in the cities and most cities do not get direct benefits from tourist money while they do spend money on public transport, roads and other things tourists use.
In most places I have been tourist tax was a very small amount, about 1% or less of the cost of being a tourist in the town.