This is from Proto-Germanic *lofo (source also of Old Norse lofi, Gothic lofa "palm of the hand," Danish lab, Swedish labb "paw"), from PIE *lep- (2) "to be flat" (see glove (n.)). As a verb, "bring the head of a sailing-ship nearer the wind," from late 14c., from the noun.
The nautical term is attested from 1660s (in a general sense of "to tack, to beat to windward"), apparently from obsolete French busquer "to shift, filch, prowl," which is related to Italian buscare "to filch, prowl," Spanish buscar (from Old Spanish boscar), perhaps originally from bosco "wood" (see bush (n.)), with a hunting notion of "beating a wood" to flush game. For the "perform in public" sense, see busker.
late 13c., from a Scandinavian source, probably Old Norse leggr "a leg, bone of the arm or leg," from Proto-Germanic *lagjaz (cognates Danish læg, Swedish läg "the calf of the leg"), a word with no certain ulterior connections. Perhaps from a PIE root meaning "to bend" [Buck]. For Old Norse senses, compare Bein, the German word for "leg," in Old High German "bone, leg" (see bone (n.)). Replaced Old English shank (n.), itself also perhaps from a root meaning "crooked."
Distinguished from an arm, leg, or fin in being used for support. Of triangle sides from 1650s (translating Greek skelos, literally "leg"). Extended to furniture supports from 1670s. Meaning "part of pants which cover the leg" is from 1570s. By 1870s as an adjective it had a salacious suggestion of artistic displays focused on the female form, such as leg-piece in theater jargon, leg-business as slang for "ballet."
The meaning "a part or stage of a journey or race" (1920) is from earlier sailing sense of "a run made by a ship on a single tack when beating to windward" (1867), which was usually qualified as long leg, short leg, etc. Slang phrase shake a leg is attested from 1869 as "dance," 1880 as "hurry up." To be on (one's) last legs "at the end of one's life" is from 1590s, the notion is of something that serves one for support and keeps one moving. To take leg bail was old slang for "run away" (1774). Legs "ability to be an enduring success, staying power" is from 1970s show business slang.