@PennyChan,
I believe originally flags were used to indicate that a taxi or horse drawn handsome cab was engaged (by a client) or vacant. A displayed flag meant vacant, no flag displayed meant engaged
Before the advent of electronic meters taxi journeys were measured by clockwork meters.
A small lever attached to the meter was used to wind up the clockwork mechanism. this lever came to have a flag like structure to indicate the meter was or was not running. Flag Up meant the meter is not running ie vacant and for hire. Flag down meant the clockwork mechanism was wound and the meter was running ie engaged and not for hire.
what is being indicated here is that cab drivers want to communicate to potential clients their cab is not for hire at this particular time