Why is the ships toilet called the "Head".

I was recently watching a classic Cary Grant movie “Operation Petticoat”. In it Tony Curtis is showing a group of female nurses around a submarine but is embarrassed to say why the toilet is called the “Head”.
Why is a ship’s toilet called the “Head”? This is only on ship but not boats? Is this only on military vessels?
Some one once told me it is because it is located behind the “Bulk Head”. What is a bulkhead and why would a toilet have to be behind it?
If anyone can relieve my frustration please let me know.

In old sailing ships the lavatory was just a plank with a few holes in it located at the front of the ship or the “head” of the ship. The planks were directly over the water so the waste would fall into the sea.

Webster’s says a bulkhead is “a partition separating compartments”, i.e. a wall. A toilet would naturally be behind walls.

It is on all waterborne vessels, civilian and miltary, ships and boats.

To elaborate on what Icerigger said, the term originated when all big ships were sailing ships. On a sailing ship, the wind blows predominantly from aft to bow. Therefore, smelly things (like the galley, and the toilet-hole) are placed at the front (the head) of the boat.

With modern plumbing and other power sources, “the head” could be placed pretty much anywhere on a modern ship.