Full story
In 2286, an enormous cylindrical probe arrives at Earth, sending out a signal nobody can read. Every ship it passes loses power. In orbit, the signal knocks out the planet's power grid and stirs up storms that blot out the sun. Starfleet sends out a distress call and tells all ships to stay away.
On Vulcan, Kirk's crew lives in exile. Spock is still recovering from coming back to life. They take the Klingon ship they captured and head for Earth to face a court-martial for what they did in the last film. On the way, Spock works out that the probe's signal is the song of humpback whales, extinct for centuries. Until someone answers, the probe will keep wrecking everything. The only way out is to go back in time, find humpbacks and bring them home.
They slingshot around the Sun and arrive in San Francisco in 1986. The trip drains their power, and the ship hides in Golden Gate Park under its cloak. The crew splits up. Kirk and Spock look for whales. Scotty, McCoy and Sulu build a tank to carry them. Uhura and Chekov hunt for a nuclear reactor whose radiation can recharge the dilithium crystals.
Kirk and Spock find two humpbacks at an aquarium in Sausalito, looked after by biologist Gillian Taylor, who is about to release them. She doesn't trust their story. Scotty and McCoy trade the formula for transparent aluminum for the tank material. Uhura and Chekov sneak onto a nuclear aircraft carrier, and Chekov is caught, questioned as a Soviet spy and badly hurt in an escape. Gillian learns the whales were released early, looks for Kirk, and together they break Chekov out of the hospital. With the humpbacks aboard, saved from whalers, and Gillian along for the ride, the ship returns to 2286. On arrival it loses power and crashes into San Francisco Bay. Freed, the whales answer the probe, which undoes the damage and leaves.
At the trial, the Federation Council acknowledges what the crew did and drops nearly every charge. One stays: Kirk disobeyed a superior. He is demoted to captain, but he gets a new ship, the Enterprise-A.

