Some water vapour is already present in the intake air, but most of the water vapour in the exhaust is formed during the combustion process of any kind of hydrocarbon when oxygen reacts with the hydrogen in the fuel.
The formation of water vapour, together with CO2, during the combustion is illustrated using combustion of the simplest hydrocarbon: methane, CH4. For ideal complete combustion:
CH4+ 2O2 → CO2+ 2H2O
The amount of water vapour is thus proportional to the amount of fuel burned. Water vapour is, in principle, a green house gas but is not considered as such since the concentration of water vapour in the atmosphere is normally considered to be constant due to rainfall.