Savings banks are institutions charged with protecting the capital of their members. Banks then invest this capital in order to make more money, and members are compensated for contributing to this capital pool through interest rates. Although there are other forms of banks, savings banks tend to be what are thought of when the word bank is used in common parlance.
Banks usually fulfill one of two purposes in games. Either they're a place for players to keep money safe, or a place to take money from illegally.
Banks as bastions of saving
There are usually two threats to a player character's assets: death and theft. Many games punish player character death by taking their money when they die, and other games have thieves which can steal money from the player character. Banks were a remedy to this situation, preventing such problems from reducing a player character's assets substantially.
Another use for banks mirrored directly their common use in real life, that of earning interest on savings. Games like Neopets and Might and Magic allowed players to deposit their money and get a return on their temporarily reduced purchasing power. Players are usually allowed to unconditionally withdraw their money without incurring penalties, though, unlike in many real banks.
Banks as big, fat heist opportunities
Before most game designers ever thought that players might want to actually use a bank the way most people in the real world use them, banks were places where money is imprisoned, only to be rescued by burglars.
Grand Theft Auto: Vice City, for instance, has a long build up to the bank heist mission, where the player character hires several specialists who will fulfill specific roles.
As in films, most game bank heists result in some sort of foul up, thus increasing the tension.
Other Uses of Banks
Some are just scenery that help lend realism to a given scene, or are included in cut scenes, such as in Grand Theft Auto III, without players actually having any hand in the action there.