I can't speak for some of the other names but Canada's codes came from the two-letter codes of railway cities. Canadian Pacific Railways had codes for all their respective cities which had a railway stop. The Y was added for commonality so as to be distinctly Canadian. (It is not to what some people may think that Canada was the last one in the race and ran out of city codes to use).
Toronto - TO (Toronto, Ontario) : YTO
Montreal - MQ (Montreal, Quebec) : YMQ
Vancouver - VR (VancouveR) : YVR
Only after when each city built more than one airport, did the names dispensed. But that's all I know, I'm afraid!