Exhibit 5.1
Consent of Independent Registered Public Accounting Firm
The Board of Directors
Canadian National Railway Company:
We consent to the use of our report dated February 1, 2022, on the consolidated balance sheets of Canadian National Railway Company as at December 31, 2021 and 2020, the related consolidated statements of income, comprehensive income, changes in shareholders’ equity and cash flows for each of the years in the two-year period ended December 31, 2021, and the related notes, and our report dated February 1, 2022 on the effectiveness of internal control over financial reporting as of December 31, 2021, incorporated herein by reference.
/s/ KPMG LLP
May 4, 2022
Montreal, Canada