Sometimes they change the code simply because it’s causing problems. Newark Airport was the first to serve New York City, and for many decades (into the 60’s, maybe even the 70’s) its code was “NYC”. But when enough “NYC” baggage started turning up at JFK, they surrendered and changed to “EWR”.
John W. Kennedy
“Compact is becoming contract; man only earns and pays.”
– Charles Williams