"cloth ensign," late 15c., now in all modern Germanic languages, but apparently first recorded in English, origin unknown, but likely connected with flag (v.) or else, like it, onomatopoeic. A less likely guess is that it is from the flag in flagstone on notion of being square and flat. U.S. Flag Day (1894) is in reference to the adopting of the Stars and Stripes by the Continental Congress on June 14, 1777.
1540s, "flap about loosely," perhaps a variant of M.E. flakken, flacken "to flap, flutter," probably from O.N. flakka "to flicker, flutter," perhaps onomatopoeic of something flapping in the wind. Sense of "go limp, droop" is first recorded 1610s. Meaning "to designate as someone who will not be served more liquor" is from 1980s, probably from use of flags to signal trains, etc., to halt, which led to the verb in this sense (1856). Related: Flagged; flagging.