It's a gasoline vent tube, serving three purposes.
Gasoline vapors can be especially dangerous under pressure (pretty much why it is useful), and as the temperature fluctuates it is safer to relieve the vapor pressure than it is to potentially have it build up. The gasoline vapors should preferably not be ejected onto a potential spark source (battery) or hot running motor.
As fuel is drawn through the carburetors or fuel pump, that volume must be replaced in the tank with fresh air or the vacuum in the tank will resist further gasoline extraction. When drawn up a long tube with very little vacuum, there is little chance of it pulling in large amounts of water, dirt, dust, or other contaminants.
If the tank were nearly full cold and then heated, or somehow overfilled, this would allow the excess to drain through the tube toward the ground in a safer area than dripping on a hot engine or battery.
Its a petrol overflow drain pipe. In case if you fill fuel that overflows it ll be drained through that pipe. it may also have internal connection with a pipe with drains rain water or any water that tries to get into the tank.