© iana_kolesnikova/stock.adobe.com
The vast majority of airport codes are easy to understand as they have a direct relation to the city in which the airport is located. Some examples of these easy to understand airport codes would be DEN for Denver International Airport, ATL for Hartsfield-Jackson Atlanta International Airport, SLC for Salt Lake City International Airport, FRA for Frankfurt Airport, or IST for Istanbul Ataturk Airport. There are also certain airports that serve more than one city and have chosen airport codes to reflect this fact like DFW for Dallas-Fort Worth International Airport or Minneapolis Saint-Paul International Airport.
Many major cities all around the world have multiple airports. In this case, as the airport codes all have to be unique and different, it's impossible to simply choose the first three letters of the city's name. This means that a city like London, which has six major airports, has the following airport codes: LHR for London Heathrow, LGW for London Gatwick, LCY for London City, STN for London Stansted, LTN for London Luton, and SEN for London Southend.
There are also cases where cities have the same names as each other, but are located in totally different parts of the world. For example, there is a Birmingham in both the state of Alabama and in the center of the United Kingdom. Again, in this case, unique airport codes need to be assigned to each of the city's airports to avoid confusion. In the case of the two Birminghams, the code BHM is used for Birmingham-Shuttlesworth International Airport in Birmingham, Alabama, while the code BHX is used for Birmingham, England.
Some airport codes seem to have nothing to do with the city in which they're based or the airport for which they have been assigned. This is because many airports change a lot over time, and one has to look back into the past to understand the significance of the code. One example would be Nashville International Airport, which has the airport code BNA. This is because the airport was originally based on an airfield called Berry Field, so the B was taken, along with the NA from the beginning of Nashville. O'Hare International Airport is another example, with this airport having the airport code ORD due to a prior name of Orchard Field.