Ketchup and catsup are simply two different spellings for the same thing, a modern, Westernized version of a condiment that European traders were introduced to while visiting the Far East in the late 17th century. What exactly that condiment was and where they found it is a matter of debate.

It could have been ke-chiap from China's southern coastal Fujian region or it could have been kicap (a Malay word borrowed from the Cantonese dialect of Chinese, also spelled kecapand ketjap) from Indonesia, both of which are sauces based on brined or pickled fish or shellfish, herbs and spices. Whatever it was, the Europeans liked it, and as early 1690, they brought it back home with them, calling it catchup.

The early Western versions of the sauce - which, starting in 1711, was sometimes called ketchup, another Anglicization of the Malay name popularized in the book An Account of Trade in India - were pretty faithful to the original Eastern ones, with one of the earliest recipes published in England (1727) calling for anchovies, shallots, vinegar, white wine, cloves, ginger, mace, nutmeg, pepper and lemon peel. It wasn't until almost a century later that tomatoes found their way into the sauce, in a recipe in an American cook book published in 1801. In the meantime, another alternative spelling popped up, mentioned in a 1730 Jonathan Swift poem: "And, for our home-bred British cheer, Botargo [a fish roe-based relish], catsup, and caveer [caviar]."

The tomato-based version of ketchup quickly caught on in the U.S. during the first few decades of the 19th century. At first, it was made and locally sold by farmers, but by 1837 at least one company was producing and distributing it on a national scale. The H. J. Heinz Company, a name that's synonymous with ketchup for most people today, was a relative latecomer to the game and didn't produce a tomato-based ketchup until 1876. They originally referred to their product as catsup, but switched to ketchup in the 1880s to stand out. Eventually, ketchup became the standard spelling in the industry and among consumers, though you can still find catsup strongholds sprinkled across the U.S.

Thanks to @SpaceJamb for suggesting the Mr. Burns photo.