There are different ways to buy a foreclosed home.
If it is listed with a real estate agent: Then you will need to submit all offers through that agent.
If the home is foreclosed on but not listed: Then you only option is to see if it is listed for sale on their website. If not, then you will need to wait until the lender decides to list the home. In most cases, you cannot go through the bank directly but must use a real estate agent.
If your are bidding on a HUD home: You will still need to go through a HUD approved agent.
If you are bidding on an auction: You can do this on your own. Just make sure you do your research and know what you are getting into. Auction homes can be tricky and come with lots of hidden problems.