"Old Shanghai" is one of the main songs from Beck's book Song Reader. It was the first "single" of sorts from the project, as a PDF of the sheet music was released online prior to the book's release. This has led to many more versions of the song out there than normal!

Beck uses the phrase "old Shanghai" and writes a song about an exotic location (a pretty common sheet music topic). There does not seem to be much more to it than that. The melody he came up with was a constant among many of the covers too -- unlike some others which had more flexibility, the "Old Shanghai" melody was so subtle and beautiful, that most interpreters stuck with it.

Notes:A lot of Song Reader borrowed a lot from older sheet music, like public domain art, old song titles, advertisements, etc. "Old Shanghai" doesn't seem to be any sort of exact reference, though the language of the phrase "old Shanghai" would be appropriate to the early 1900s. To wit:

There was a racist sheet music song called "Since Tommy Atkins Taught The Chinese How To Charleston! (Out In Old Shanghai"):

Beck often used references like these as a bit of a songwriting exercise. Like "Rough On Rats" with the name of a famous rat poison, he probably saw references to "Old Shanghai" and wrote to the title.