Viktor Navorski (Tom Hanks), a traveler from the fictional nation of Krakozhia, arrives at New York’s John F. Kennedy International Airport, only to discover that his passport is suddenly no longer valid. The United States no longer recognizes Krakozhia as an independent country after the outbreak of a civil war, and Viktor is not permitted to either enter the country or return home as he is now stateless. Because of this, U.S. Customs and Border Protection seizes his passport and airline ticket.
Frank Dixon (Stanley Tucci), the temporary customs director of the airport, sees no other option but to let Viktor stay in the transit lounge until the issue is resolved. Viktor settles in at the terminal with only his luggage and a Planters peanut can. Viktor finds a gate currently under renovation, and makes it his home. He befriends and assists airport employees and travelers. Among them is a flight attendant named Amelia Warren (Catherine Zeta-Jones), whom he sees periodically and tries to woo, after she mistakes him for a building contractor who is frequently traveling. Dixon, who is being considered for a promotion, becomes more and more obsessed with getting rid of Viktor. Viktor begins reading magazines and newspaper articles to learn English. After he impulsively remodeled a wall at the renovation zone, he is hired by an airport contractor and paid under the table.
One day, Dixon pulls Amelia aside and questions her regarding Viktor and his mysterious peanut can. Amelia, who realizes Viktor hasn’t been entirely truthful, confronts him at his makeshift home, where he shows her that the Planters peanut can contains a copy of the “A Great Day in Harlem” photograph. His late father was a jazz enthusiast who had discovered the famous portrait in a Hungarian newspaper in 1958, and vowed to collect the autographs of all 57 of the musicians featured on it. He died before he could get the last one, from tenor saxophonist Benny Golson. Viktor has come to New York to do so. After hearing the story, Amelia kisses Viktor.
After nine months, his friends wake Viktor with the news that the war in Krakozhia has ended, and he gets a green stamp, allowing him to leave the airport. Amelia also asked her “friend”—actually a married government official with whom she had been having an affair—to get Viktor a one-day emergency visa to fulfill his dream, but Viktor is disappointed to learn she has renewed her relationship with the man during this process. Moreover, Viktor finds out that Dixon must sign the visa. Seizing the opportunity, Dixon threatens to cause trouble for Viktor’s friends, most seriously by deporting janitor Gupta (Kumar Pallana) back to India to potentially face a charge of assaulting a police officer. Unwilling to let this happen, Viktor finally agrees to return home to Krakozhia. When Gupta learns of this, however, he runs in front of the plane which will take Viktor back home, effectively taking the burden off Viktor.
The delay gives Viktor enough time to get into the city. Dixon orders his officers to arrest Viktor, but they instead let him leave the airport. As Viktor is getting in a taxi, Amelia arrives in another taxi, and they briefly make eye contact. Dixon himself arrives at the taxi stand only moments after Viktor’s taxi left. When his officers arrive, Dixon pauses for a moment before telling them that they have incoming travelers to handle. Viktor arrives in New York at the hotel where Benny Golson is performing and finally collects the last autograph. Then he gets in a taxi, telling the driver, “I am going home.”