Pete "Maverick" Mitchell is a talented but reckless naval aviator assigned to a naval aircraft carrier in the Indian Ocean, along with his best friend Nick "Goose" Bradshaw. When two bogey enemy planes intercept Maverick and his companions while they're in the air, Maverick manages to intercept the MiG-28s and help a colleague "Cougar" land his plane, against official orders. Stinger, the officer, doesn't approve of Maverick's recklessness, but decides to send him to Top Gun, a training school for the best naval aviators.
On the night before classes, Maverick tries to seduce an attractive woman at the bar, and is startled to learn the next day that she is one of his instructors at Top Gun, Charlotte Blackwood, an astrophysicist. When she hears about his run-in with the MiGs, Charlotte is intrigued by Maverick and wants to know more.
Maverick is continually reckless at Top Gun, and while he proves that he's a great pilot, his disregard for the rules gets him into hot water with his instructors and colleagues. In particular, Maverick's nemesis and the top pilot in the program, Iceman, sees Maverick's flying as dangerous. Meanwhile, Charlotte and Maverick fall in love.
During one training session, Maverick is following Iceman and wants to get ahead of him to make a shot. Unexpectedly, Maverick's plane gets stuck in Iceman's jet wash, which sends his craft into a spin. When Maverick and Goose eject from the plane, Goose hits the canopy of the plane and dies.
Maverick takes responsibility for Goose's death, has a post-traumatic inability to fly like he used to, and considers leaving Top Gun. Viper, one of his instructors, tells Maverick that he flew with Maverick's father in Vietnam, and that his father's plane disappeared when he was acting heroically on behalf of his fellow pilots. Viper encourages Maverick to make his own decision about whether or not to come back to Top Gun.
When Maverick returns to graduation from Top Gun, the graduates suddenly get called to deploy. Iceman and Maverick are both called to the Indian Ocean to complete a rescue mission. On the mission, Maverick has a moment of fear and hesitation, before resolving to act heroically, saving the day and making sure that everyone gets back to the base safely. When Stinger offers him any job he wants around the country, he elects to teach at Top Gun.