Larry Daley's unstable work history causes his former wife Erica to believe that he is a bad example to their ten-year-old son Nick, and Larry fears that Nick respects his future stepfather, Don, more than him. Cecil Fredricks, an elderly security guard about to retire from the American Museum of Natural History, hires Larry despite his unpromising résumé. The museum, which is rapidly losing money, plans to replace Cecil and his two colleagues Gus and Reginald with one guard. Cecil gives Larry an instruction booklet on how to handle museum security, advises Larry to leave some of the lights on, and warns him not to let anything "in...or out".
Once night falls, Larry discovers that the exhibits come to life, including a playful Tyrannosaurus skeleton nicknamed "Rexy" who behaves like a dog; a mischievous capuchin monkey named Dexter; rival miniature civilizations led by Old West cowboy Jedediah and Roman general Octavius; abusive, limb-ripping Attila the Hun; an Easter Island Moai obsessed with chewing gum; and a wax model of Theodore Roosevelt. Roosevelt explains that since an ancient Egyptian artifact — the Golden Tablet of Pharaoh Ahkmenrah — came to the museum in 1952, all of the exhibits come to life each night. If the exhibits are outside the museum during sunrise, they turn to dust. Roosevelt helps Larry by restoring order, but only for one night.
Larry quits the next morning, not wanting a life-threatening job. However, when Nick comes to see him at work and expresses interest in his job, Larry remains as a night guard. When Larry tells Cecil that Dexter tore up his instructions, Cecil advises him to study history. He also learns more from museum docent Rebecca Hutman, who is writing a dissertation on Sacagawea, but does not feel she knows enough about her subject.
The next night, Larry uses what he has learned to better control the exhibits, but four Neanderthals set fire to a display. One of the Neanderthals turns into dust after escaping. The next morning, museum director Dr. McPhee almost fires Larry after what had happened to the Neanderthal exhibit until Larry begs him to reconsider. Larry offers Rebecca a meeting with Sacagawea, but she believes that he is mocking her and the museum.
Larry brings Nick to the museum to show him the exhibits, but none of them come to life. They find Cecil, Gus, and Reginald stealing the tablet and other valuable objects. Like the exhibits, the guards receive enhanced vitality from the artifact and plan to frame Larry for the thefts. They have also disabled the tablet to stop the exhibits from interfering. With his father's encouragement, Nick reactivates the tablet and runs away with the artifact. After a chase throughout the museum, Cecil locks up Nick and his father in the Egyptian room and steals back the tablet. Larry releases Ahkmenrah's mummy from his sarcophagus. The pharaoh speaks English from many years as an exhibit at Cambridge and helps Larry and Nick escape. The three find the other exhibits fighting. After helping Attila deal with past trauma causing him to act out, Larry convinces the exhibits to work together.
The exhibits capture Gus and Reginald without difficulty, but Cecil escapes by stagecoach. He almost runs Sacagawea over, but instead slices Teddy in half when he shoves her out of the way. Larry, Nick, Ahkmenrah, Jed, Octavius, Rexy, and Atilla the Hun pursue Cecil to Central Park, where they stop him and regain the tablet. Jed and Octavius crash their remote-controlled Hummer but survive. Teddy is fixed by Sacagawea with warm wax. Rebecca sees the exhibits return to the museum before sunrise and realizes that Larry was telling the truth; he introduces her to Sacagawea. McPhee almost fires Larry again after seeing news reports of the strange events around the museum — such as cave paintings in the museum's subway station, dinosaur footprints in Central Park, and cavemen sightings. However, upon seeing how much these events raised attendance, he reconsiders. Larry, Nick, and the exhibits celebrate the following night.
During the credits, Cecil, Gus and Reginald are now working as janitors at the museum.
Ben Stiller as Lawrence "Larry" Daley
Carla Gugino as Rebecca Hutman
Dick Van Dyke as Cecil Fredericks
Mickey Rooney as Gus, a veteran security guard
Bill Cobbs as Reginald, a veteran security guard.
Jake Cherry as Nicholas "Nick" Daley
Ricky Gervais as Dr. McPhee
Kim Raver as Erica Daley
Charlie Murphy as the taxi-driver.
Paul Rudd as Don, Erica's fiancé.
Anne Meara as Debbie
Robin Williams as a wax model of Theodore Roosevelt
Patrick Gallagher as a wax model of Attila the Hun
Rami Malek as the mummy of Ahkmenrah
Pierfrancesco Favino as a bronze statue of Christopher Columbus
Steve Coogan as Octavius, a miniature figure.
Mizuo Peck as a polyurethane model of Sacagawea
Owen Wilson as "Jedediah", a miniature cowboy figure (uncredited and only credited in the rest of the film series)
Kerry van der Griend, Dan Rizzuto, Matthew Harrison, and Jody Racicot as the wax models of Neanderthals
Martin Christopher as a wax model of Meriwether Lewis
Martin Sims as a wax model of William Clark
Randy Lee, Darryl Quon, Gerald Wong, and Paul Chih-Ping Cheng as the wax models of the Huns
Brad Garrett as the voice of the Easter Island Head
Crystal the Monkey as Dexter, a stuffed Capuchin monkey
based on the 1993 children's book of the same name by Croatian illustrator Milan Trenc