As a cub, Alex the lion was called Alakay and was the son of Zuba, the alpha lion. Though Zuba tries to teach Alakay to be a hunter, the cub is more interested in dancing. When another lion named Makunga challenges Zuba to a fight for the position of alpha lion, Alakay is captured by poachers. Though Zuba tries to rescue his son, Alakay is forced into a crate. The crate falls into the ocean where it drifts to New York. There, Alakay is renamed Alex and sent to the Central Park Zoo where he grew up, meeting Gloria, Marty, and Melman.
In the present time, Alex, Gloria, Melman, Marty, King Julien, Maurice, and Skipper and his fellow penguins board a repaired airplane in the hopes of using it to fly back to New York. Though the plane does fly, it ends up crash-landing in Africa because of lack of fuel. In Africa, the animals are amazed to find more of their kind. Alex is re united with Zuba and his mother. Marty quickly fits into a herd of zebra who all look, sound, and talk exactly like him. Melman takes on the position of witch doctor amongst the animals. Gloria, interested in finding a mate, attracts the attention of a smooth-talking but shallow hippo named Moto Moto.
Meanwhile, the penguins set about repairing the plane. They carjack several jeeps from New Yorkers on vacation, leaving the tourists stranded and lost in the jungle. A tough old woman called "Nana" takes charge, reminding them that they are New Yorkers and always survive.
Unfortunately, life in Africa is not as wonderful as it first seems. Makunga, still determined to take the position of alpha lion, reminds Zuba that Alex must complete a traditional lion coming-of-age challenge. Alex, thinking that the challenge is a dance contest (it is actually a fight) competes against the strongest lion (who was recommended by Makunga) and loses quickly. To avoid being forced to banish Alex for failing, Zuba abdicates and Makunga immediately takes the position and banishes Alex and his family. Marty meanwhile begins to feel upset that all of the zebras are exactly the same as him, leaving him with nothing unique. Melman is happy as a witch doctor until he learns that he has the same spot that had apparently caused the previous witch doctor to die. Melman is also upset about Gloria dating Moto Moto, as Melman has secretly loved her for a long time. Gloria goes on a date with Moto Moto and quickly realizes that he only loves her for her body.
The next day, the animals are in a panic when they discover that the watering hole has dried up. Determined to make up for his earlier failure, Alex and Marty decides to risk being shot by hunters and leave the reserve to discover what happened. The pair discover that the stranded New Yorkers, under the instruction of Nana, have dammed the river and built a primitive civilization. Alex is captured and Marty runs for help. Meanwhile, Zuba hears what Alex did and goes to rescue him.
King Julien suggests that the animals sacrifice one of themselves into the volcano to appease the water gods and regain their water supply. Believing that he will die soon, Melman volunteers to be sacrificed. Gloria stops him just in time and Marty arrives to tell them of Alex's fate. The trio, the penguins, and several chimpanzees use the newly-fixed plane to come to the rescue. Alex meanwhile manages to rescue both himself and his father by dancing for the New Yorkers, who quickly recognize him from the zoo. The other animals rescue the lions with the plane and destroy the dam, freeing the water. Alex manages to remove Makunga from power by tricking Nana into attacking him and she drags him back to the other marooned tourists. Skipper marries a bobble-head hula doll from the plane and leaves on a honeymoon, leaving the other animals to remain in Africa. Taking stage for Madagascar 3.
- Ben Stiller as Alex the Lion
- Chris Rock as Marty the Zebra, Other Zebras
- David Schwimmer as Melman the Giraffe
- Jada Pinkett Smith as Gloria the Hippopotamus
- Sacha Baron Cohen as Julian the Lemur
- Cedric the Entertainer as Maurice the Aye-Aye
- Andy Richter as Mort the Lemur
- Bernie Mac as Zuba the Lion
- Sherri Shepherd as Florrie the Lioness (credited as "Mom")
- Alec Baldwin as Makunga the Lion
- Elisa Gabrielli as Nana
- Will.i.am as Moto Moto the Hippopotamus
- Tom McGrath as Skipper the Penguin
- Chris Miller as Kowalski the Penguin
- Christopher Knights as Private the Penguin
- John DiMaggio as Rico the Penguin
- Conrad Vernon as Mason (Phil is unvoiced)
- Fred Tatasciore as Teetsi the Lion, Poacher #1
- Eric Darnell as Joe the Witch Doctor, Poacher #2
- Al Roker as Newscaster
- Stephen Kearin as Stephen the Giraffe, Rhinoceros, Tourist with video camera
- Danny Jacobs as Tourist with New York T-shirt
- Dan O'Connor as Cape Buffalo, Tourist with University Shirt
- Stacy Ferguson as Female Hippopotamus
- Harland Williams as Additional Giraffe
- Bridget Hoffman as Female Tourist
- Quinn Dempsey Stiller (Ben Stiller's real-life son) as Baby Alex
- Thomas Stanley as Baby Marty
- Zachary Gordon as Baby Melman
- Willow Smith as Baby Gloria
- David P. Smith as Bobby the Dik-Dik
- Connor Rayburn as Little Giraffe
- John Eric Bentley (additional voices)