The "GM" that got the money was already restructured, it is "new GM", the shareholders in old GM were wiped right out.
https://en.wikipedia.org/wiki/Motors_Liquidation_Company
Propping up GM legitimately helped hundreds of thousands of workers. Whether it was a good use of the money is a different question than that, but the money didn't go to shareholders, it went to keeping the operations going.