How is a military jet given a nickname? Does the manufacturer name the plane? For example, did Lockheed Martin name the Raptor (F-22) and Lightning II (F-35)?
Typically for modern US aircraft, since the military pays the contractor for the aircraft's development, so they are paying for it, and get to name it. This article says the USAF named the F-35 as the "Lightning II". However, the reality is much more likely, the F-35 Joint Program Office (the JPO), named the aircraft, given it international status and being a joint aircraft, and the announcement was made by the USAF. The JPO, being a joint office, always has a Program Executive Officer (PEO), and a Deputy, from both the USAF and USN (alternating positions). The F-22 was likely named by the USAF F-22 project office, which was based at Wright-Patterson Air Force Base, Dayton, Ohio. See here.
However, this isn't always the case, at least historically. For example, the Lockheed Orion & Hercules, (and the Constellation) follow a tradition of Lockheed of naming their aircraft after celestial objects, stated here and here. The A-12 was also named by flight crews as the Cygnus (swan), another constellation, to follow this pattern. So, some US military aircraft, in the past, have been named by the manufacturer.
As another example, the F-111 is believed to be the only US aircraft to go through its service career without being officially named. On its retirement, the USAF designated it the "Aardvark". While the name was made official by the USAF, it came from the term the crews used for it.
Its American crew called the F-111 the Aardvark. It was a good name. Like the South African aardvark, the F-111 was a solitary night hunter. Like the aardvark, it rooted in the dirt, guided by excellent senses. And like the aardvark, it had very long range. For much the same reasons, Australians called it the Pig.
So, while in the past, sometimes the manufacturer named the aircraft, sometimes the crews, it would seem, today, the US government, through their military force, chose the name.
Ah yes......airplane names. Official ‘names’ for aircraft come from various sources for a variety of reasons. OEM engineers usually hold this with a great deal of disdain, finding it extremely dorky to call such a design a ‘Fighting Falcon’ or a ‘Hornet’ and generally prefer to call them by internal company designations eg Lockheed Martin Model 632 is better known to the public as an F-22 Raptor, etc. Some names occasionally come from within the OEM like the YF-23, which received the nickname of ‘Black Widow II’ both in honor of Northrop’s earlier P-61 Black Widow and the arachnid shaped radar returns it produced earlier on during development.
Military program offices usually create official names, some deliberately for political or otherwise reasons. An F-35 is called the Lightning II in honor of both the US Lockheed P-38 Lightning and the UK English Electric Lightning, the latter a fitting tribute since the UK was the biggest contributor partner nation, both financially or otherwise, on the JSF project. Another example is the F-14, given the name ‘Tomcat’ both in honor of the feline name heritage for Grumman’s long line of naval fighters and for Admiral Tom Connolly, who resisted McNamara’s efforts to accept the troubled F-111B as the Navy’s new fighter and lobbied for a new design.
These names occasionally do not stick; The USAF originally called the F-16 airplane the ‘Fighting Falcon’ but F-16 aircrews never liked the designation. Instead they called the airplane the ‘Viper’, in reference to the fictional Viper starfighters in the TV show Battlestar Galactica. The jet also was informally nicknamed ‘Electric Jet’ in reference to its then novel fly-by-wire flight control system and ‘Lawn Dart’, in reference to how numerous development F-16s augered in and crashed while engineers struggled to perfect said system.
Speaking of that, most aircraft names are created informally by aircrews. Some are flattering like the SR-71’s ‘Lady in a Black Dress’ or ‘Habu’ after a venemous snake indigenous to Okinawa. Some are not eg the F-105 Thunderchief is the ‘Lead Sled’ after it notoriously poor maneuverability, the A-7 is the SLUF or Short Little Ugly F*cker. It’s also common in the civilian world. An A-320 is often called ‘Scarebus’ - a play on Airbus, ‘Nintendo Jet’ and ‘Die by Wire’ - referencing the jets flight control system, ‘Sully’s Ark’ - referencing the Cactus 1549 crash on 1/15/09, etc.