If free banking is so great and has worked in the past, why then did central banks develop? Free bankers answer this question by arguing that central banks generate seignorage revenue for governments, thus central banks exist for a fiscal reason. Although this may be the case for some developing economies, central banks generate relatively little income in economies with sophisticated tax-raising bureaucracies.
The mainstream and dominant view is that central banks exist to stabilise the financial system, which is prone to episodic crises. Central banks are believed to stabilise the economy by providing liquidity to individual institutions as well as the system as a whole. As central banks can essentially print money, they are able to create such liquidity almost ex nihilo. The problem with this view is that historical banking systems were relatively stable even without a central bank. In addition, the ongoing financial crisis occurred despite (and maybe because of) the existence of sophisticated central banks.
The other explanation as to why central banks (and the gold standard) emerged has been put forward by the late Earl Thompson of UCLA and Charlie Hickson. Thompson and Hickson suggests that central banks operating under a gold standard were a vital institution which ensured the survivability of democracies. As democracies are overly appeasing in the face of an external threat, a central bank with a national currency which could expand the money supply in a defensive emergency was necessary for the long-term survivability of democratic nations. You can read their argument in full by clicking here.