In September 1939, Władysław Szpilman (Adrien Brody), a Polish-Jewish pianist, is playing live on the radio in Warsaw when the station is bombed during Nazi Germany's invasion of Poland. Hoping for a quick victory, Szpilman rejoices with his family at home when learning that Britain and France have declared war on Germany. But the promised aid does not come. Fighting lasts for just over a month, with both the German and Soviet armies invading Poland at the same time on different fronts. Warsaw becomes part of the Nazi-controlled General Government. Jews are soon prevented from working or owning businesses, they are also made to wear blue Star of David armbands.
By November 1940, Szpilman and his family are forced from their home into the overcrowded Warsaw Ghetto, where conditions only get worse. People starve, the guards are brutal, and starving children are abandoned in the streets. On one occasion, the Szpilmans witness the SS kill an entire family in an apartment across the street during a round-up.
On 16 August 1942, Szpilman and his family are transported to Treblinka extermination camp as part of Operation Reinhard. But a friend in the Jewish Ghetto Police recognises Władysław at the Umschlagplatz and separates him from his family. He becomes a slave labourer and learns of a coming Jewish revolt. He helps the resistance by smuggling weapons into the ghetto, on one occasion narrowly avoiding a suspicious guard. Szpilman eventually manages to escape and goes into hiding with help from a non-Jewish friend, Andrzej Bogucki, and his wife Janina.
In April 1943, Szpilman watches from his window as the Warsaw Ghetto Uprising, which he aided, unfolds and then ultimately fails. After a neighbor discovers Szpilman in the flat, he is forced to flee to a second hiding place. The new room has a piano in it but he is compelled to keep quiet while beginning to suffer from jaundice.
In August 1944, during the Warsaw Uprising, the Polish resistance attacks a German building across the street from Szpilman's hideout. Tank shells hit the apartment forcing him to flee. Over the course of the following months, Warsaw is destroyed and abandoned. Szpilman is left alone to search desperately for shelter and supplies among the ruins. He eventually makes his way to an abandoned house where he finds a can of pickles. While trying to open it he is discovered by Wehrmacht officer Wilm Hosenfeld who learns that Szpilman is a pianist. He asks Szpilman to play on a grand piano in the house. The decrepit Szpilman manages to play Chopin's Ballade in G minor. Hosenfeld lets Szpilman hide in the attic of the empty house. From here, he was regularly supplied with food by the German officer.
In January 1945, the Germans are retreating from the advance of the Red Army. Hosenfeld meets Szpilman for the final time promising he will listen to him on Polish Radio after the war. He gives Szpilman his German Army greatcoat to keep warm and leaves. However, this has almost fatal consequences for Szpilman because he is mistakenly thought to be a German and is shot at by Polish troops liberating Warsaw. In Spring 1945, former inmates of a Nazi concentration camp pass a Soviet prisoner-of-war camp holding captured German soldiers and verbally abuse them. Hosenfeld, who is among those captured, overhears a released inmate lament over his former career as a violinist. He asks the violinist if he knows Szpilman, which he confirms. Hosenfeld wishes for Szpilman to return the favor and help release him. Sometime later, the violinist is able to bring Szpilman back to the site but they find it has been long abandoned.
Later, Szpilman works for Polish Radio and performs Chopin's Grand Polonaise brillante to a large and prestigious audience. An epilogue states that Szpilman died at the age of 88 in the year 2000 while Hosenfeld died in Soviet captivity in 1952.

Question: How does Szpilman meet Hosenfeld?
Answer: Hosenfeld finds Szpilman opening a can of pickles after the destruction of Warsaw.