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.
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.
You can use words like Gag,Gibe,Jest or Wag...
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.