The air is drawn in from the roof. As a result, air at that level is cooler and cleaner since it is less disturbed.
The air is hot and full of contaminants close to your engine, so it can't be used. Therefore, truck snorkels are tall and thin.
By doing this, your vehicle benefits because a computer on it, or modern vehicles at least, measures the input it receives. You get more power and fuel economy from the cooler air.