flag (n.1) Look up flag at Dictionary.com
"cloth ensign," late 15c., now in all modern Germanic languages (German Flagge, Dutch vlag, Danish flag, Swedish flagg, etc.) but apparently first recorded in English, of unknown origin, but likely connected to flag (v.1) or else an independent imitative formation "expressing the notion of something flapping in the wind" [OED]. A guess considered less likely is that it is from flag (n.2) on the notion of being square and flat.

Meaning "name and editorial information on a newspaper" is by 1956. U.S. Flag Day (1894) is in reference to the adopting of the Stars and Stripes by the Continental Congress on June 14, 1777.
flag (v.1) Look up flag at Dictionary.com
1540s, "flap about loosely," probably a later variant of Middle English flakken, flacken "to flap, flutter" (late 14c.), which probably is from Old Norse flaka "to flicker, flutter, hang losse," perhaps imitative of something flapping lazily in the wind. Sense of "go limp, droop, become languid" is first recorded 1610s. Related: Flagged; flagging.
flag (n.2) Look up flag at Dictionary.com
"flat stone for paving," c.1600, ultimately from Old Norse flaga "stone slab," from Proto-Germanic *flago- (see flake (n.)). Earlier in English as "piece cut from turf or sod" (mid-15c.), from Old Norse flag "spot where a piece of turf has been cut out," from flaga.
flag (n.3) Look up flag at Dictionary.com
plant growing in moist places, late 14c., "reed, rush," perhaps from Scandinavian (compare Danish flæg "yellow iris") or from Dutch flag; perhaps ultimately connected to flag (v.1) on notion of "fluttering in the breeze."
flag (v.2) Look up flag at Dictionary.com
1875, "place a flag on or over," from flag (n.1). Meaning "designate as someone who will not be served more liquor," by 1980s, probably from use of flags to signal trains, etc., to halt, which led to a verb meaning "inform by means of signal flags" (1856, American English). Meaning "to mark so as to be easily found" is from 1934 (originally by means of paper tabs on files). Related: Flagged; flagging.