There are two types of airport codes: Four-letter ICAO codes used for flight operations/ATC, and three-letter IATA codes used for passenger handling.
ICAO codes consist of a two-letter country prefix and a two-letter airport code. Some countries (those with lots of airports) have more than one prefix. The USA has 26 - KA to KZ. Canada has four, CU, CW, CY and CZ. The vast majority of Canadian airports use IATA codes starting in CY.
(There are some that start in CZ. CU and CW are used for special purposes such as airport met offices.)
For most of the world ICAO codes and IATA codes bear no resemblance to each other. LHR is EGLL, AMS is EHAM, CDG is LFPG.
In the USA and Canada, however, IATA codes are based on ICAO codes.
For US airports the IATA code is the ICAO code without the initial K. JFK is KJFK, LAX is KLAX.
For Canadian airports the IATA code is the ICAO code without the initial C. Hence CYOW = YOW, CYYZ = YYZ.