The actual origin of the term lollygag is unknown, although many sources trace it back to mid-19th century America. Some sources also provide an alternative spelling of lallygag, although this doesn't exactly help establish the word's historical origins, either. To lollygag means to fool around or dawdle, primarily to avoid actual work or to start other unappealing activities.
Children trying to avoid going to school may lollygag by eating their breakfast in dribs and drabs, or else spend an inordinate amount of time getting dressed or grooming. Some may waste time by watching television instead of dressing or playing a video game instead of finishing homework. The point of effective lollygagging is to waste as much time as possible without the appearance of obvious laziness.
Some people prefer to lollygag in their favorite stores at the local shopping mall, meandering through the aisles at a leisurely pace instead of going directly to the original destination. While taking one's time while shopping may be perfectly acceptable, accusations of lollygagging or dilly-dallying often appear when time is an issue. By definition, lollygagging is a deliberate effort to delay work or finish a project, much like goldbricking in an office environment.
The origins of lollygagging may have something to do with the word loll, which generally means to lie passively or leisurely around the premises. It is possible that "lolling around" became corrupted into "lolly" first, and then attached to the archaic word "gag" to indicate the habits of lazy sheep lying around a field. To lollygag may have originally meant to sit passively while others performed chores. A lazy person can also be described as a doo-lolly in some circles, so the term lollygag is quite possibly a similar form of rural slang to describe lazy people.
Lollygagging is often ascribed to those who deliberately wander off or meander as a passive-aggressive attempt to avoid serious work or a rigid deadline. Other expressions such as dilly-dally or fiddle around also cover this same lackadaisical territory.