MCO (Orlando) comes, IIRC, from its days as McCoy airfield (or air force base, I can't remember). MCI (Kansas City) was once called "Mid-Continent International Airport.
Usually, the code is derived from the name of the city (SAN, LAS, DFW, MEM, PIT, BOS, FRA, MAD, SEA, ANC, HKG, TLV, AMM, CAI are good examples), sometimes from the name of the airport (JFK, LGA, BWI, MDW, BDL, STN, CDG, DME, NRT, PBI, PHF, EZE, GIG), and sometimes from a combination of the two (LHR, LCY, LGW, DTW).
In Canada, most (all?) codes begin with Y - often with little regard for either the airport or city name. Who'd guess that YYZ=Toronto or YYT=St. John's? Some are related, though, like YVR (Vancouver), YWG (Winnipeg), and YYC (Calgary).
Some airport codes take the city or airport name and use another letter, often X, to fill it out: DXB (Dubai), LAX(Los Angeles), PDX (Portland, Oregon), PWM (Portland, ME).
IAH is an acronym for Intercontinental Airport Houston, and IAD is for International Airport Dulles. I have to suspect DCA is for District of Columbia Airport, and the SNA stands for Santa Ana, a city near Orange County Airport.