c. 1500, kind of small bird that has its tail in continuous motion (late 12c. as a surname), earlier wagstart (mid-15c.), from wag (v.) + tail (n.). From 18c. as "a harlot," but this sense seems to be implied much earlier:
If therefore thou make not thy mistress a goldfinch, thou mayst chance to find her a wagtaile. [Lyly, "Midas," 1592]