The Cypriot banks had lot of foreign money deposited in them due to the low corporate tax rates in the country. What they did with all this money? Well, they had bought lot of Greek sovereign debt!! Wow. Whether they did this foolishly believing it was an investment or whether they wanted to "help' out Greece, that I do not know.
But once Greece went into trouble and the value of that debt went down even more, Cypriot banks turned to their government looking for a bailout. Long story short, European banks (+Imf etc) have imposed the tax on deposits as a precondition and other austerity demands, but I guess you cannot make up a 17bn euro shortfall even if you fire the entire Cypriot government and cut all the politician salaries (and cut banker salaries also along with that).
But the government of Cyprus itself had huge public debt (at ~80% of GDP), and they are on the Euro (so they cannot just print new money, and if they did they would go the way of Zimbabwe). In the case of Cyprus, although their currency is the Euro (only in name), the (foreign) confidence in the government was gone - hence, when the time for the bailout came, instead of "devalueing" a non existent local currency, they are just doing some financial juggling and reducing the existing deposits of euros in Cypriot banks.
Note that (imo) these deposits are not actually stored in wads of cash or backed by gold equal to their value. They are merely a number in the computers of the world's money system.
This is my understanding of this issue. What do you think?
Update: After writing this, I came across an article on the Guardian which explains the problem in good detail, with some history. Apparently Laiki bank was bailed out by the Cypriot govt last June to the tune of several billion euros. (details here).
Full link: http://www.guardian.co.uk/business/2013/mar/25/cyprus-bailout-deal-at-a-glance
The debt of Cyprus will rise to 143% its GDP after this bailout. So Cyprus had better come up with some solid invention/economic product that will help them make that debt go down fast. Perhaps it might be bad for Cypriots to take some tips from the Japanese in innovation and industriousness, instead of protesting their government's actions.