I think when they bailed them out the government (provincial and federal) was given GM stock to hold in return. The province and feds eventually sold the stock at a loss but they saved those jobs for another 10 years so many think it was money well spent. The quote below is from the Globe and Mail and the link below provides an excellent overview of the issues and history.
General Motors Corp. filed for bankruptcy protection in 2009. A multibillion-dollar bailout made the U.S., Canadian and Ontario governments part-owners of the company. More cuts came under the so-called Government Motors era, and thousands more jobs were lost when Oshawa’s consolidated plant was closed. In all, Ottawa gave $7.23-billion to GM, and the province $3.6-billion, and when both governments unloaded their GM shares in 2015, they lost about $3.5-billion on their taxpayer-funded investment.