The aircraft carrier Enterprise 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 ship is Lt. Peter Mitchell, going by the callsign Maverick, a callsign appropriate for his arrogant rule-bending attitude; his RIO is Lt. Nicholas Bradshaw, callsigned Goose. Their wingmate goes by the callsign Cougar with his RIO callsigned Merlin. 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 Couger to the deck.
Cougar sees the captain of the Enterprise, known as Stinger, 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 Kazansky, callsigned Iceman, and his RIO, callsigned Slider. At a bar the night after their first day at the School Maverick notices a pretty young blonde in jeans, and hits on her by following her into the ladies room. It seems not to work until the next day she appears at the School, for she is a DoD instructor on enemy aircraft, known as Charlie. 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, callsigned Jester, 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 and Maverick refuses to have any of it, even after the School's leader, Commander Michael Metcalf - callsigned Viper - 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 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. 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 reengages after a whispered sentence of "Talk to me, Goose," when he grasps Goose's dog tags and managed to destroy several of the enemy MiGs and drive off the last two.
When the jets return to the carrier, they're greeted with cheers and applause from the crew. After Maverick and Iceman exchange their form of thanks, Maverick throws goose's tags off the back of the ship, showing he successfully was able to let him go.