He won because:
- the NDP and the CPC were both led by deeply unpopular leaders: Jagmeet Singh the silk clad, Rolex-wearing self styled "man of the people" and Pierre Poilievre who is so dislikeable he routinely polls double digits below his party
- Trump threatening to collapse the Canadian economy and/or annex us by force
- Flat economic growth
- Carney's credentials on the economy being unparalleled in Canadian politics (see previous point)
- Voters tired of the far-left big government nanny state philosophy that was the hallmark of the Trudeau governments and Carney successfully presented himself as a centrist
Interestingly, Carney was appointed to the Bank of Canada by a Conservative PM and I'd argue he's got a similar appeal that Trump initially had, but for different reasons: Trump positioned himself as an outsider, and Carney is similarly not a career politician. By contrast his only real challenger (Poilievre) hasn't had a real job in his life and has been living on the taxpayer's dime his entire career.
I think voters in both the US and Canada are sick of slimy politicians.
(Edit: can't reply because rate limited, better go back to pointless discussions about JavaScript. My usage of "far left" should be understood as being relative to the Canadian political spectrum. Justin Trudeau was definitely a very left-leaning PM by any rational measure)