Origin of "a head of steam"
No analogy. It's an engineering term. Head is a measure of pressure. Head is measured in units of distance, (typically feet in the US) and is the height of a column of fluid (usually water) that exerts an equivalent pressure at the bottom of the column.
For example here is a table of head vs psi:
So when the engineer wants to get the train moving he needs to build up enough 'head' (steam pressure) to move the train.
I am an engineer. "Head" is a a term of pressure. There are components to it though. There is static head, pressure head, and dynamic head. A head of steam refers mainly to pressure head. This is the pressure of steam in the steam drum of a pressure (usually propulsion for trains or steam ships) boiler after it has been fired to anything above atmospheric pressure, and thus has the ability to do work. There are other things called "friction head", "dynamic head" and "static head" that are also common commonly measured in terms of feet. The "feet" means the feet of height of a column of liquid of the same temperature of the fluid whose pressure is being measured. Head is used extensively in engineering terms when specifying boilers, pumps, etc, and also in the design of piping systems which need to account for "head loss" due to pipe friction from the fluid moving inthe pipes. Old steamship engineers like myself used the term occasionally for one main purpose and that was when raising steam pressure to it's design pressure for the boiler before using it to roll the turbines. And I am not that old, so maybe that explains why we never really used that term to much. We had a big old pressure gauge that read in PSIG that told us what we needed to know.
As other answers point out, this is a term to describe pressure. The most basic technique for creating water pressure involves either storing the water in a raised container (think water towers) or in maintaining a reservoir of sufficient depth to achieve relative height. The higher the height, called "head," the higher the pressure, which is why pressure formulated as "head" is measured in distance (often feet).
The use of the term "head" is appropriate simply because it is a measure of height, and the highest point of anything can be referred to as a head.
Although steam is a different method of generating pressure, the term carries over. As you can see from the chart in Jim's answer, although in the phrase you're asking about the use is colloquial, not technical, it is not just a figure of speech put a defined unit of measurement as well.
Reference:
A Text Book on Hydraulics - 1906
Section 61 (at the bottom of the linked page):
61. Meaning of "Head" - The word head is used by writers on Hydraulics in a somewhat indefinite way. In all cases it means the height of a column of water, either actual or ideal. Thus, "head on an orifice," or on any point of an orifice, has in preceding discussions been used to designate the vertical height of the free surface of water above the point under consideration.
Merriam-Webster, entry "Head"
Definition 9a: the uppermost extremity or projecting part of an object