They are cousins, not the same game
Both are rummy: you collect cards into sets and runs. After that they part company, and if you have arrived here looking for "gin rummy for the family", Shanghai is almost certainly the game you actually want.
Side by side
| Gin rummy | Shanghai | |
|---|---|---|
| Players | Two | Three to twenty |
| Length | Hands until someone reaches a target | Exactly seven rounds |
| What you must make | Whatever you like, then knock | A named contract that changes every round |
| Runs | Three or more | Four or more |
| Jokers | Usually none | Yes, wild |
| Taking a thrown card out of turn | No | Yes — buying, and it costs you |
| Winning | Highest score | Lowest score |
Why the confusion
In a lot of families both games are simply called "rummy", and Shanghai in particular travels under many names — contract rummy, Progressive Rummy, Liverpool Rummy, Shanghai Rummy, and in Dutch households often just sjanghai. The rules drift a little from kitchen to kitchen; the seven contracts on this site are the common version.
Which should we play tonight?
Two of you, quick and sharp: gin rummy. A table full of people of wildly different ages who want to talk while they play: Shanghai. The contracts give everyone the same goal each round, which keeps a beginner in the game far longer than gin rummy does.