It's very fitting for someone like Charlie Chaplin to call life a gag. Similar to how entertainers say "show must go on", meaning something like "what ever happens, we'll go on living"
This is a very sad sentiment to express, it's kind of like, "you are born, you study, you fall in love, you search for meaning of life, and then you die". Everything you did in meantime was in vain. You gave your best, but at the end, joke, a gag, was on you.
It's especially sad thing, I think, him being such famous comedian, it'd be easy to miss a point of word "gag" in this case. I think I'll ponder deep in the night on this one, it's so lovely. :)