It measures mass
1 litre of 5 degree air has more mass than 1 litre of 95degree air.
Hotter air has molecules that are further apart.
The wire is kept at a very high temp.
The oncoming air molecules hit it and cool it down. The more molecules hit it, the more it cools down.
The more it cools down, the more current has to be applied to keep it's temp unchanged.
It's that 'compensating' current that is used by the ECU