"The Pianist" begins in Warsaw, Poland in September, 1939, at the outbreak of the Second World War, first introducing Wladyslaw (Wladek) Szpilman, who works as a pianist for the local radio. The Polish Army has been defeated in three weeks by the German Army and Szpilman's radio station is bombed while he plays live on the air. While evacuating the building he finds a friend of his who introduces him to his sister, Dorota. Szpilman is immediately attracted to her.
Wladyslaw returns home to find his parents and his brother and two sisters, packing to leave Poland. The family discusses the possibility of fleeing Poland successfully and they decide to stay. That night, they listen to the BBC and hear that Britain and France have declared war on Germany. The family celebrates, believing the war will end once the Allies are able to engage Germany.
Conditions for Jews in Warsaw quickly deteriorate. Wladek meets with Dorota, who accompanies him around Warsaw to learn of the injustice Jewish people have to face under the new Nazi regime. Businesses that were once friendly to them now won't allow their patronage. Wladek's father is harshly forbidden to walk on the sidewalk in the city by two German officers; when he begins to protest, one of the men hits him in the face. The family soon has to move to the Jewish ghetto established by Nazi rule. The Holocaust is starting, and the family, though well-to-do before the war, is reduced to subsistence level, although they are still better off than many of their fellow Jews in the overcrowded, starving, pestilential ghetto.
Wladyslaw takes a job playing piano at a restaurant in the ghetto, turning down an offer from a family friend to work for the Jewish Police, and the family survives, but living conditions in the ghetto continue to worsen and scores of Jews die every day from disease, starvation, and random acts of violence by German soldiers. One night the family sees the SS march into a house across the street and arrest a family. The eldest man is unable to stand when ordered because he is confined to a wheelchair and the SS officers throw him over the balcony to his death. The other family members are gunned down in the street and run over by the SS truck if they survived.
By 1942, the aged father must apply for working papers through a friend of Wladek's, so that he can take a job in a German clothier. However, the day comes when the family is selected to be shipped to their deaths at the Treblinka concentration camp. Henryk and Halina are selected and taken away and the rest of the family is sent to the Umschlagplatz to wait for transport. They are later reunited. As the family sits under the blazing sun with hundreds of other Jews waiting for the trains, the father uses the family's last 20 zlotys to buy a piece of candy from a boy (who apparently isn't aware of his own impending doom). Each family member eats a tiny morsel of candy, their last meal together.
As they are going to the trains, Wladyslaw is suddenly yanked from the lines by Itzak Heller, a Jewish man working as a police guard. Wladyslaw watches the rest of his family board the train, never to be seen again. He hides for a few days in the cafe he played piano in with his old boss there. He later blends in with the ten percent or so of the Jews that the Nazis kept alive in the ghetto to use for slave labor, tearing down the brick walls separating the ghetto and rebuilding apartment houses for new, non-Jewish residents. He is put to work, under grueling, abusive conditions, building a wall. He thinks he sees an old friend Janina Godlewska (a singer), but she passes quickly. He learns that some of the Jews are planning an uprising, and helps them by smuggling guns into the ghetto. While carrying bricks, he drops a load of them and is given a new job supplying the workers with building supplies. He also helps smuggle guns in potato sacks -- the weapons will be given to the resistance fighters on the other side of the wall for the uprising. At one point, he is almost caught by a German officer, who suspects that Wladek is hiding something in a sack of beans. After this close call, he decides he must escape and take his chances in the larger city, so with the help of friend, Majorek (who was the friend that got his father working papers), he escapes and finds Janina and her husband.
They take Wladyslaw to his caretaker Gebczynski (a man with the Polish resistance), who hides him for one night. The next day Gebczynski takes him to a vacant apartment near the ghetto wall, where he can live indefinitely on smuggled food; he must be silent however, since several non-Jews also live in the building and believe the apartment is empty. There, Wladek watches the Jewish Ghetto Uprising of April/May1943, for which he helped smuggle the weapons, and watches weeks later as the uprising is finally crushed and its participants killed. Later, Gebczynski wants to move Wladek as the Nazis have found the weapons of the Polish resistance, forcing Gebczynski to be on the run also. Gebczynski says it's only a matter of time before the Nazis find the apartment Wladek is hiding in. Wladek decides to stay put, feeling safer where he is. His friend gives him an address to go to in case of an emergency, and leaves, gravely warning Wladek not to be caught alive by the Nazis. Wladyslaw remains in the apartment a few more months until he has an accident, breaking some dishes. The noise has blown his cover, and he has to scurry out of the building, being chased by an angry German woman who suspects him of being Jewish.
Wladek goes to the emergency address he was given, where he surprisingly meets Dorota, who is now married, pregnant, and her brother dead. Dorota and her husband hide Wladek in another vacant apartment, where there is a piano, but his new caretaker, Szalas, is very slack about smuggling in food, and Wladyslaw once more faces starvation, and at one point almost dies of jaundice. Dorota and her husband visit him, finding him gravely ill. They report that Szalas had been collecting money from generous and unwitting donors and had pocketed it all, leaving Wladek to die in isolation.
Wladek recovers in time to see the larger 1944 Warsaw Uprising, in which the Poles tried to retake control of their city. Soon, Nazis start attacking the building and he has to flee. The Poles had expected the advancing Soviet Red Army to help them, but the Russians did not come, instead allowing the Germans to put down the revolt, and drive the entire remaining population of Warsaw out of the city. Wladyslaw hides in the abandoned hospital that had been across the street from his second hideout. The Germans had by then decided to burn Warsaw to ashes, so Wladyslaw flees the hospital and jumps back over the wall into the ghetto, now an abandoned, desolate wasteland of bricks and rubble.
He stays there, rummaging through burned-out buildings to find something to eat, and continues to hide, until one night a Nazi officer, Captain Wilm Hosenfeld, finds him. To prove to Hosenfeld that he is a pianist, he plays a somber and brief rendition of Chopin's "Ballade in G Minor", the first time he has played since he worked in the Jewish ghetto years before.
Hosenfeld, moved by Szpilman's playing, helps him survive, allowing him to continue hiding in the attic even after the house is established as the Captain's headquarters. Hosenfeld eventually abandons the house with his staff when the Russian army draws closer to Warsaw. Hosenfeld gives Wladek a final parcel of food and his overcoat. He asks Wladek his surname, which sounds exactly like "spielmann", the German word for pianist. Hosenfeld promises to listen for Wladek on the radio. Hosenfeld also tells him that he only needs to survive for a few more days; the Russian army will liberate Warsaw soon. Shortly afterward, Wladyslaw sees Polish partisans, and, overcome with joy, goes outside to meet his countrymen. Seeing his coat given to him by Hosenfeld, they think he is a German and try to kill him, before he can convince them he is Polish.
In the Spring, newly freed Poles walk past an improvised Russian prisoner of war camp, and Hosenfeld is among the prisoners. The Poles hurl insults at the Germans through the fence, but when Hosenfeld hears that one of the Poles is a musician, he goes to the fence and tells him that he helped Wladyslaw, and asks him to ask Wladyslaw to return the favor, before a Russian soldier throws him back down on the ground. The Polish musician does indeed bring Wladyslaw back to the site to petition the Russians, but they have departed without a trace by the time he gets there. Wladyslaw is unable to help Hosenfeld, but he returns to playing piano for the radio station.
Closing title cards tell us that Hosenfeld died in a Soviet gulag in 1952. Wladyslaw lived to be an old man, dying in Poland at the age of 88. The cards are intercut with footage of Wladek triumphantly playing Chopin's Grand Polonaise Brilliante in concert.