Airport codes: IATA and ICAO
Airport codes come in two systems, and most airports carry one of each: a three-letter IATA code for the commercial side of aviation, and a four-letter ICAO code for the operational side.

What is an airport code?
An airport code is a short identifier for an airport. Most airports carry two: a three-letter IATA code for the commercial side of aviation, and a four-letter ICAO code for the operational side.
What is the difference between IATA and ICAO codes?
The short one belongs to IATA. Its own description of its coding schemes says that airlines and CRSs may request the assignment of a unique three-letter code to identify a location like an airport, and that bus and ferry stations can qualify too where they connect into air travel. That's the code you see when you book something.
The long one is the ICAO location indicator, and it's what goes in the box on an international flight plan. FAA guidance tells filers to file a 4-letter LOCID whenever available for the departure and destination aerodromes, and shows the regional logic plainly: for airports in the contiguous United States you convert the three-letter code by prefixing a K. The first letter or two tells you roughly where in the world you are.
To try one right now, the airport code lookup takes either code, or an airport name, and returns the airport with both codes and its coordinates. To see a code set as a print, type it in. For one worked example, Heathrow's codes, LHR and EGLL, are on their own page, and so are Gatwick's, Manchester's and Edinburgh's.
Why one of them ends up on a wall
Because the three-letter code stops being an abbreviation after a while and starts being a name. It's the airport somebody learned to fly at, or flew out of to start something, or has taped inside a flight bag for years. Three letters carry all of that and take up almost no room, which is the whole idea behind the airport code print.
Codes belong to runways, which is what a runway is, and the rest of the ground sits on the sky.
