Most ketchup recipes - even homemade ones - include several tablespoons of sugar. Commercial ketchup often has lots of high-fructose corn syrup. What purpose does all of this sugar serve in a ketchup recipe?
High fructose corn syrup is a preservative. While sugaring your ketchup is good for flavor, HFCS is great for shelf stability, as is the vinegar.
The reasons you typically see HFCS in American Ketchups is that it is (1) heavily subsidized and domestic and cheap, (2) farmed by the same companies making the tomatoes, and (3) a preservative. Also, it helps to improve flow while maintaining viscosity.
Sugar generally can be used to cut the acidity in a tomato dish without inhibiting the taste or outshining the tomato. My stepfather had digestion issues with high acidity meals and swore by a teaspoon or two of sugar to help aid the stomach issues. Likewise, the acidity of ketchup may well be mitigated by all the sugar.
Everyone who likes ketchup surely likes the sweet and tangy taste it always has, so in some sense the question's a bit circular.
But I imagine part of the reason people started making it that way is that the sweetness helps cover up the sourness, so it can contain more vinegar (which helps preserve it) without tasting awful.
Sugar acts as a preservative and also adds taste to the food. Also, many food products use natural preservatives like sugar, salt and oil.