"a joke," 1863, especially a practical joke, probably related to theatrical sense of "matter interpolated in a written piece by the actor" (1847); or from the sense "made-up story" (1805); or from slang verbal sense of "to deceive, take in with talk" (1777), all of which perhaps are from gag (v.) on the notion of "to stuff, fill." Gagster "comedian" is by 1932.