This is going to get a bit technical but should still be understandable even if you slept through chemistry classes.
When is hydrogen dangerous?
Just as with the fuel-air mixture in an engine, hydrogen is combustible only when it's within a range of concentrations. We use what are called the Lower Explosive Limit (LEL) and the Upper Explosive Limit (UEL) which are the concentrations of gas (in air) that will ignite. For hydrogen gas, the LEL is 4% and the UEL is more than 75%, meaning that if the concentration of hydrogen gas reaches 4%, it is at the level that could ignite with a spark. For comparison, the natural concentration of H2 in the atmosphere is about 0.01%.
How does a car battery produce hydrogen gas?
A car's battery is filled with a mixture of 36% sulphuric acid (SO4) and 64% water (H2O). Hydrogen gas is released when the battery is charging due to a process called electrolysis in which water decomposes into its constituent hydrogen (H) and oxygen (O) in the presence of a voltage that is greater than the decomposition voltage equilibrium. That voltage is 1.227V for water. The normal voltage for a single lead-acid battery cell is 2.1V and there are six of them in series in a car battery (6 x 2.1 = 12.6V). Because the cell voltage is higher than the decomposition voltage for water, very small amounts of gas are almost always being produced. However, the worst case (most hydrogen) is produced when forcing maximum current into an already fully charged cell. It's also a temperature-sensitive reaction, so higher temperatures will tend to produce more gas.
How much hydrogen is produced?
The reaction we're interested in is the one for hydrogen ions (H+) becoming hydrogen gas (H2). Chemists would write it like this:
2H+ + 2e- --> H2
This just means that two hydrogen ions plus two electrons yields one molecule of hydrogen gas. (It also implies that the the gas comes from the negative electrode, but remember this is per cell.)
Skipping much of the mathematics and chemistry details, we can calculate that at a temperature of 25C (77F), we produce about 0.45 liter of hydrogen gas per cell per 1 Ah (amp-hour) overcharge. So pushing 10A through a fully charged standard 6-cell battery for one hour would produce 0.45 l/Ah x 6 x 10A x 1 h = 27 l of hydrogen gas at 25C. For that to be dangerous, we'd need at least a 4% concentration, so we'd need a total volume of air + hydrogen to be 675 liters or less. Jump starting doesn't usually occupy a whole hour and usually doesn't involve overcharging an already charged battery.
Where does the hydrogen go?
As anyone who has ever heard of the Hindenburg disaster knows, hydrogen is both lighter than air and also combustible. Because it's lighter than air, any hydrogen gas released from the battery will tend to rise.
The bottom line
In the typical under hood placement of a car battery, most of the hydrogen will rise harmlessly into the atmosphere as soon as the hood is opened, but more may be produced as the car is being jumpstarted. That's why the hoods should stay open and why it's also good practice to first connect (and first disconnect) the negative connection as far from the battery as practical.
Automotive designers have already gone through these calculations and the concentrations under the hood are much much lower than 4% even in extreme situations of charging system malfunction. For instance, standards such as IEEE 484 describe a design target of no more than 2%.