Everything is in a name: this northern port of modern-day Poland began as 'Gyddanyzc', continued as Gdansk, converted to Danzig, and then reverted back to Gdansk. In that litany lies the story.
'Gyddanyzc' first appears in the story of Adalbert, an ill-fated but well-meaning bishop from Bohemia who hoped to tame the wild Prussian tribe living in the northern lands. They didn't take kindly to his Christianizing ways and martyred him brutally in 997. Because they continued to plague the calmer residents in this region, the Polish king invited in some reinforcements - the Teutonic Knights - in 1226. The Knights proved effective: instead of wasting time on gentler methods, they simply wiped out the Prussians. They also wiped out the Poles when they took over Gdansk in 1308. The city was then renamed 'Danzig', resettled with Germans, and redeveloped into a mercantile powerhouse. It grew stronger, bigger, and better, crowning its success 50 years later when it joined the Hanseatic League.
But all was not well with the ruling Knights. Considered a decidedly unwelcome guest by now, the Knights failed to fend off the combined might of the Poles and company in 1410 at the bloody, bloody battle of Grunwald. Shortly thereafter in 1454, Danzig itself threw them out, earning the undying gratitude of the Polish king along with the more tangible monopoly on Poland's grain trade.
From then on until the second Partition, Danzig remained a (mostly) independent city, growing into the greatest port in central Europe. Part of its strength depended on its culturally and ethnically diverse population: the Protestant Scots found refuge here, along with the Jews, and anyone else who failed to appreciate the religious repression rampant elsewhere in Europe. The Dutch and the Flemings also left their mark: the city's (reconstructed) Old Town draws from their architectural influence, which gave it a cosmopolitan mix that settled well with its diverse population.
Despite its strength, Danzig fell prey to the partition-happy power of neighboring Prussia at the end of the 18th century. Following the Partitions, a time when Danzig followed the rest of Poland into decline, the city regained its independent status, coined as the 'Free City of Danzig', along with Poland in 1918. But unfortunately, it did not remain free for long. At the tip of the Polish Corridor which ensured that Poland had access to the sea, it stuck out as a likely target for an ambitious Nazi Germany, so likely a target that World War II began there. When it ended, around 10% of the city remained. Its mostly German population was expelled, the city handed back to Poland, and re-re-named Gdansk.
After a few quiet decades rebuilding the city and its shipping industry, Gdansk again hit the international headlines in 1980 when the Lenin Shipyard strike catapulted Lech Walesa onto the world stage and the labour union 'Solidarity' onto all sympathetic lips. The back and forth of the 80's finally gave way to a conclusive strike in 1989: the Round Table talks began, and Poland woke up to another period of freedom.