I wonder what CN locos were doing this far south 20 or-so years before CN acquired IC and it’s then-current US subsidiaries GTW and the former Central Vermont didn’t have trackage this far south either. Seeing a CN loco anywhere outside of Canada must have been a very rare sight prior to CN’s expansion into the US in the late 1990s. Nowadays CN locos can be seen on the former IC and as well as trackage-rights or pool power on BNSF and other class 1s, especially in the midwest.
In the past (before the widespread run-through power of today) there were several cases where CN power went off line. I believe there were a few times when CN was in a surplus situation and leased some power to an American road. There were also occasions when locomotives were exchanged for a month or two for testing by one or other railroad. A GP40 will be familiar to any shop and would be a likely candidate either way. Not sure what may have been happening in your case though.
Conrail did lease a bunch of CN power in the fall of 1976 on for a very short time. The CN took the locomotives back after they found Conrail wasn’t keeping the locomotive cabs to CN’s liking (or so went the rumor at the time…)