Looking on the World Wide Words website, it looks like it started as an insult for people who were being too smarmy and affectionate in public. In other words, too much PDA (PDA means Public Displays of Affection). Here is the article: http://www.worldwidewords.org/weirdwords/ww-lol1.htm
Please do not lolly gag in the hallway.
Although he made a good gag, nobody even smiled.
come gag
gag
The term gag factor refers to the gag reflexes. For example, a baby has very sensitive gag reflexes so even small amounts of food may cause the baby to gag.
Please do not lolly gag in the hallway.
The term "lollygag" is believed to have originated in the mid-19th century in the United States. It is thought to be a combination of "lolly," which may derive from "loll," meaning to lounge or move lazily, and "gag," which could refer to a playful or foolish act. The word originally described wasting time or being idle, often in a lighthearted or carefree manner. Its playful connotation has persisted in contemporary usage.
gag
gag
Although he made a good gag, nobody even smiled.
come gag
gag
The DVD did not have enough space to hold the gag reel.
Soap
Gag
There is a list of gag gifts on word press - the link to which can be found in related links.
The slang word "gag" can have different meanings depending on the context. It can mean a joke or something funny, as in "That comedian's set was a gag." It can also mean something that is overwhelming or excessive, as in "The amount of work I have to do is such a gag." Additionally, "gag" can refer to a act of forcefully preventing someone from speaking or making noise, often used in the context of comedy or entertainment.