The word 'flag' has an etymology that is, fittingly for a word about identification, difficult to pin down. It appeared in English in the early sixteenth century, seemingly from nowhere, and rapidly displaced older terms like 'banner' (from Old French 'baniere'), 'standard' (from Old French 'estandart'), and 'ensign' (from Latin 'insignia'). The most widely accepted theory traces it to a Scandinavian source — possibly an unrecorded Old Norse *flaga, related to Old Norse 'flaga' (a slab of stone) and the verb 'flakka' (to flutter, to flap about), from Proto-Germanic *flakō (something flat).
The Proto-Germanic root *flak- expressed the concept of flatness combined with movement — something thin and broad that flutters or peels away. This root may also be the source of English 'flap' (to move flat wings up and down), 'flake' (a thin flat piece that peels off), and possibly 'flaw' in its older sense of a sudden gust of wind (a flat blast of air). If this connection holds, then 'flag' was originally a description of the object's physical behavior: a flat thing that flaps in the wind.
The sixteenth-century emergence of 'flag' in English coincides with the great age of European maritime expansion, when naval flags became essential for identification, communication, and signaling at sea. The earliest recorded English uses relate to naval and military contexts. A 'flagship' was originally exactly that: the ship in a fleet that carried the commanding admiral's flag, making it identifiable to the other vessels. 'Flagstaff' and 'flagpole' followed as compounds describing the staff from which the cloth was flown.
Flags as communication tools developed an elaborate coded language at sea. The International Code of Signals assigns specific meanings to flags of different patterns and colors: a solid yellow flag (Quebec/Q) means 'my vessel is healthy and I request free pratique,' while a solid red flag (Bravo/B) means 'I am taking in or discharging or carrying dangerous goods.' Semaphore flag signaling — holding two flags in different positions to spell out letters — became a standard naval communication method in the eighteenth and nineteenth centuries, before being superseded by radio.
The verb 'to flag' (to grow weak, to droop, to lose energy) may be related to the noun, through the image of a flag that ceases to flap and hangs limp when the wind dies. This sense appeared in the mid-sixteenth century, roughly contemporary with the noun. The computing sense of 'flag' (a marker or indicator in software) draws on the signaling metaphor: a flag in code marks a condition, just as a physical flag signals a state.
The cultural and political significance of flags has given the word enormous emotional weight in modern usage. 'Flag-waving' (demonstrative patriotism) and 'false flag' (a deceptive operation designed to disguise the responsible party) are both metaphors that depend on the flag's fundamental function as an identifier — a piece of cloth that declares 'this is who we are' or, in the case of a false flag, 'this is who we want you to think we are.' The conceptual journey from a flat thing that flaps in the wind to a charged symbol of national identity is one of the most dramatic semantic expansions in the English lexicon.