early 13c., "waver, vacillate, lack steadfastness," probably from a Scandinavian source (cf. Old Norse vagga "a cradle," Danish vugge "rock a cradle," Old Swedish wagga "fluctuate"), and in part from Old English wagian "move backwards and forwards;" all from Proto-Germanic *wagojanan (cf. Old High German weggen, Gothic wagjan "to wag"), probably from PIE root *wegh- "to move about" (see weigh). Meaning "to move back and forth or up and down" is from c.1300. Wagtail is attested from c.1500 as a kind of small bird (late 12c. as a surname); 18c. as "a harlot," but seems to be implied much earlier:
Wag-at-the-wall (1825) was an old name for a hanging clock with pendulum and weights exposed.