Star Trek

In the 23rd century, the Federation starship USS Kelvin is investigating a "lightning storm" in space. A Romulan ship, the Narada, emerges from the storm and attacks the Kelvin. Narada's first officer, Ayel, demands that the Kelvin's Captain Robau come aboard to negotiate a truce. Robau is questioned about the current stardate and an "Ambassador Spock", whom he does not recognize. Narada's commander, Nero, kills him, and resumes attacking the Kelvin. George Kirk, the Kelvin's first officer, orders the ship's personnel, including his pregnant wife Winona, to abandon ship while he pilots the Kelvin on a collision course with the Narada. Kirk sacrifices his life to ensure Winona's survival as she gives birth to James T. Kirk.
Seventeen years later on the planet Vulcan, a young Spock is accepted to join the Vulcan Science Academy. Realizing the Academy views his human mother Amanda as a "disadvantage", he joins Starfleet instead. On Earth, Kirk becomes a reckless but intelligent young adult. Following a bar fight with Starfleet cadets accompanying Nyota Uhura, Kirk meets Captain Christopher Pike, who encourages him to enlist in Starfleet Academy, where Kirk meets and befriends doctor Leonard McCoy.
Three years later, Commander Spock accuses Kirk of cheating during the Kobayashi Maru simulation. Kirk argues that cheating was acceptable because the simulation was designed to be unbeatable. The disciplinary hearing is interrupted by a distress signal from Vulcan. With the primary fleet out of range, the cadets are mobilized. McCoy and Kirk board Pike's ship, the Enterprise. Realizing that the "lightning storm" observed near Vulcan is similar to the one that occurred when he was born, Kirk breaks protocol to convince Pike that the distress signal is a trap.
Enterprise finds the fleet destroyed and the Narada drilling into Vulcan's core. The Narada attacks the Enterprise and Pike surrenders, delegating command of the ship to Spock and promoting Kirk to first officer. Kirk, Hikaru Sulu and Chief Engineer Olson perform a space jump[5][6] onto the drilling platform. Olson is killed but Kirk and Sulu disable the drill. Despite their efforts, Nero launches "red matter" into Vulcan's core, forming an artificial black hole that destroys Vulcan. Spock rescues the high council and his father Sarek, but Amanda dies.
As the Narada moves toward Earth, Nero tortures Pike to gain access to Earth's defense codes. Spock maroons Kirk on Delta Vega after Kirk attempts mutiny. Kirk encounters an older Spock, who explains that he and Nero are from 129 years in the future. In that future, Romulus was threatened by a supernova. Spock's attempt to use "red matter" to create an artificial black hole and consume the supernova failed, and Nero's family perished along with Romulus. The Narada and Spock's vessel were caught in the black hole, sending them back in time. Nero stranded Spock on Delta Vega to watch Vulcan's destruction.
Reaching a Starfleet outpost, Kirk and the elder Spock meet Montgomery Scott. With the elder Spock's help, Kirk and Scott beam onto the Enterprise. Following the elder Spock's advice, Kirk provokes younger Spock into attacking him, forcing Spock to recognize he is emotionally compromised and relinquish command to Kirk. After talking with Sarek, Spock decides to help Kirk. While the Enterprise hides itself within the gas clouds of Titan, Kirk and Spock beam aboard the Narada. Kirk fights with Nero and Ayel, killing the latter and rescuing Pike while Spock uses the elder Spock's ship to destroy the drill. Spock leads the Narada away from Earth and sets his ship to collide with Nero's ship. Enterprise beams Kirk, Pike and Spock aboard. The older Spock's ship and the Narada collide, igniting the "red matter". Kirk offers Nero help to escape, but Nero refuses, prompting Kirk to give the order to fire, dooming the Narada to be consumed in a black hole.
Kirk is promoted to Captain and given command of the Enterprise while Pike is promoted to Rear Admiral. Spock encounters his older self, who persuades his younger self to continue serving in Starfleet, encouraging him to do what feels right instead of what is logical. Spock remains in Starfleet, becoming first officer under Kirk's command. The Enterprise goes to warp as the elder Spock speaks the "where no one has gone before" monologue.

Question: Why does Nero torture Pike?
Answer: To gain access to Earth's defense codes.