The aircraft carrier USS Enterprise (CVN-65) is on patrol near the Persian Gulf when radar contact is made with a MiG fighter. The Combat Air Patrol of the Enterprise is vectored to meet the incoming aircraft, and the fighters involved are F-14 Tomcat interceptors, each manned by a pilot and a Radar Intercept Officer. The pilot of the lead plane is Flight Lieutenant Peter "Maverick" Mitchell (Tom Cruise
), a callsign appropriate for his arrogant rule-bending attitude; his RIO (Radar Intercept Officer) is Lt. Nicholas "Goose" Bradshaw (Anthony Edwards
). The second F14 is piloted by Bill "Cougar" Cortell (John Stockwell
) with Sam "Merlin" Wells (Tim Robbins
) as the RIO. The two F14s split up and are surprised when a second MiG, shielded from radar by riding within feet of its leader, appears. Cougar is outmaneuvered by MiG One while Maverick locks his missile radar on MiG Two, who promptly disengages. MiG One stays on Cougar and is only chased off when Maverick flies upside down, closes up on the MiG, and flashes an obscene gesture to the enemy pilot. The MiG disengages and the two Tomcats fly to the Enterprise, but Cougar is so rattled he cannot land, forcing Maverick, low on fuel and against orders, to abort his own landing and talk Cougar to the deck.
Cougar sees the captain of the Enterprise, Tom "Stinger" Jordan (James Tolkan
), and turns in his wings. This forces Stinger to change his intended disciplinary action against Maverick, for he must send a Tomcat tandem for additional combat training at the Navy's Fighter Weapons School in Miramar, CA, near San Diego, and the Captain is disgusted that Maverick is the only qualified candidate for the assignment.
Maverick, however, is quietly overjoyed as he regards the assignment as an opportunity, and upon arrival begins to build a rivalry with a fellow Tomcat pilot, Lt. Tom "Iceman" Kazansky (Val Kilmer
), and his RIO, Ron "Slider" Kerner (Rick Rossovich
). At a bar the night after their first day at the School, Maverick notices Charlotte Blackwood (Kelly McGillis
) a pretty young blonde in jeans, and hits on her by following her into the ladies room and serenading her. It seems not to work until the next day she appears at the School, revealing herself to be Charlie, a previously unseen DOD flight instructor that Maverick had assumed to be male. Though technically a civilian, she has mastered the flight simulator, where she has beaten several actual pilots. She begins to become smitten with Maverick before the official competition begins.
In his first exercise, Maverick takes on the School's resident "enemy" pilot, LTC Richard "Jester" Heatherly (Michael Ironside
), and succeeds in outmaneuvering him and "shooting" him down, but in so doing he flies below a set minimum engagement altitude - a "hard-deck" - and then compounds this faux pas by overflying a flight tower at absurdly low altitude just to show himself off.
Iceman chews out Maverick for his "unsafe" attitude, but Maverick refuses to have any of it, even after the School's leader, Commander Michael "Viper" Metcalf (Tom Skerritt
) summons him to his office and threatens to expel him should he continue this way. Metcalf, however, knows Maverick, for Maverick's father flew with him in Vietnam off the USS Oriskany (CVA-34) and was shot down when he engaged the enemy in "neutral" airspace.
The contest between Maverick and Iceman continues; in a later exercise Viper and Jester team up against Maverick and fellow F14 pilot Hollywood. Maverick breaks a cardinal rule by abandoning his wingman to go after Viper, and in so doing Hollywood is "shot down" and then the same fate befalls Maverick.
But the worst is yet to come, for Maverick is teamed with Iceman and Maverick, determined to win the School contest, angrily chews out Iceman for taking too long to attack an enemy craft; Maverick takes the shot, but when the two aircraft get close, the backwash from Iceman's thrusters cripple Maverick's engines and the F14 plunges toward the sea. Goose barely succeeds in yanking open the emergency ejection handles, but when the fighter's canopy pops open, the two pilots eject and Goose crashes into the canopy, killing him.
Maverick is devastated by Goose's death, and though an inquiry clears him of wrongdoing, his confidence is destroyed. He nonetheless graduates from the class and is reassigned to the Enterprise, where an incident with enemy MiGs leads to a fateful battle involving Iceman as well as Maverick. Iceman, and Hollywood are launched to intercept a pair of MiGs but are jumped by four additional enemy fighters. Hollywood is shot down and Iceman hopelessly surrounded when Maverick is launched, now with Merlin as his RIO. Maverick quickly arrives at the scene of battle but is surrounded by enemy and when he flies into one ship's jetwash his own fighter briefly stalls out - and though he regains control he flashes back to Goose's death and breaks off, leaving Iceman (who has long doubted Maverick's courage after Goose's death) trapped as Merlin desperately and furiously yells at Maverick to get back into battle. Maverick pull himself together and returns to assist Iceman, and they destroy four MiGs, prompting the remaining squadron to retreat. With this, Maverick and Iceman finally become friends. As a reward for his heroism, Maverick is offered any assignment he chooses. He chooses to be an instructor at Top Gun. He tosses Goose's dog tags into the ocean, signifying he has come to terms with his friend's death.