In 1876, Prince Leopold Mountbatten, Duke of Albany (Hugh Jackman), is a stifled dreamer. His strict uncle Millard (Paxton Whitehead) has no patience for his disrespect for the monarchy, chastising him and telling him he must marry a rich American, as the Mountbatten family finances are depleted. After his uncle told him that on his "thirtieth birthday he had become a blemish to the family name", Leopold counters that the new nobility is to be found in those who pursue initiatives, hence his interest in the sciences.
One day, the Duke finds Stuart Besser (Liev Schreiber), an amateur physicist (and descendant of Leopold) in his study perusing his schematic diagrams and taking photographs of them. He had seen him earlier at Roebling's speech about the Brooklyn Bridge, after he was laughing at the word "erection." Leopold follows Stuart and tries to save him from falling off the unfinished bridge, only to fall with him into a temporal portal between centuries that Stuart has used to travel to 1876.
Leopold awakens in 21st century New York City. He is at first confused and thinks that he has been kidnapped. Stuart says that he has created formulae to forecast portals in the temporal universe and that Leopold must stay inside his apartment until the portal opens again a week later. As Stuart takes his dog out, he is injured by falling into the elevator shaft, and is eventually institutionalized for speaking about his scientific discovery. (According to Stuart's books, Leopold's unintentional time travel to the 21st century has caused a disruption of all elevators, on account of his leaving the 19th century before he could register for a patent.)
Leopold is intrigued by the cynical and ambitious Kate McKay (Meg Ryan), Stuart's ex-girlfriend, who comes to the apartment for her Palm Pilot stylus. He observes that she is a "career woman" and that her field, market research, is a fine avocation for a woman and states that he once dated a librarian from Sussex. Kate dismisses him and demands that he take Stuart's dog for a walk. Leopold is overwhelmed to see that Roebling's bridge is still standing. Back at the apartment, he befriends Charlie (Breckin Meyer), Kate's brother and an actor between gigs, who believes him to be an actor as well, steadfast to his character.
Kate and Leopold become romantically involved as they dine and tour New York.
When shooting begins on the commercial in which Leopold has agreed to act, he finds the product, diet margarine, disgusting. He cannot understand how Kate would have him endorse a flawed item without qualms, and declares that "when one finds oneself participating in an endeavour entirely without merit, one withdraws." Echoing his uncle, Kate says that sometimes one has to do things one doesn't want to. He chides her about integrity. She retorts, "I don't have time for pious speeches from two hundred year old men who have not worked a day in their life". Their dalliance seems at an end.
Stuart escapes from the mental hospital, and sends Leopold back to his own time. That night, while Kate is accepting her promotion at a company banquet, he and Charlie are racing to meet her. Moments before she goes on stage, they arrive and produce pictures from Stuart's camera that show her in 1876. Stuart says that he had thought he disrupted the spacetime continuum, but actually "the whole thing is a beautiful 4-D pretzel of kismetic inevitability".
Kate chooses a life with Leopold over her career, and the three of them escape to the Brooklyn Bridge. There, catching the portal before it closes at midnight, Kate vanishes into 1876, where Leopold appears resigned to be pragmatic, as Kate and his uncle had advised him, and marry Miss Tree for her family fortune; but, just as he is about to announce his intention to become engaged to Miss Tree, as he opens his mouth to speak, he sees Kate and announces her name, Kate McKay, as his bride-to-be.
In the closing scene, they kiss and the camera is drawn outward showing a grandfather's clock depicting 12:15.

Question: How did Stuart travel back in time to 1876?
Answer: He used a temporal portal.