How did the word 'Gag' become both a choke, and a joke?

by boredguy12

Why would someone use the word Gag, to choke in disgust, for a funny joke/pun that makes you laugh?

demian123456789

Probably something for r/linguistics