Why would a government bail out private banks?
Because the banks are not loaning their own money but that of depositors. One may also argue that the depositors should know the risks and if their bank makes bad investments it is partly their fault so they cannot complain should they lose their deposits. But a functioning banking system is essential to the current economic system. The bankruptcy of a big bank would cause panic and banks runs, which because of fractional reserve banking would probably result in the insolvency of other banks, banks that perhaps made good investments but ones that cannot immediately be liquidated. After the closing of the banks considerably less savings would be deposited in financial institutions. This will hinder consumption because credit/debit card traffic would cease and getting investment funds would also be considerably more difficult.

So the governments have considered the damage the bankruptcy of a bank would cause to their economy and decided it is better to bail them out. ("Too big to fail.") Of course since banks have a very large revenue stream they can also afford lobbying for intervention as well, but this does not mean that the intervention is not beneficial to the public. Furthermore, if you lose your deposits you may very well (wrongly) blame the government, so a bail-out is also politically prudent.

If you are interested in what could be done I recommend reading about the Glass-Steagall act.

If you are not satisfied with my answer there are any number of conspiracy theories that offer unconvincing alternative explanations.