As the gas drains out through the petcock and into the carb, the space that it took up in the tank needs to be replaced with air. The air comes from out side the tank through the hose in the cap. The hose is used so relatively clean air from behind the number plate or in the steer pivot will be drawn into the tank. Modern bikes also have a one way check valve in the hose so air will flow in but gas won’t flow out (when the bike is upside down).
So the mechanic is right, the hose lets the tank breathe in but not out.