The joke is a pun. Bubblegum is something that people chew.  To get 'chewed out' means to get scolded by someone. It implies that the man had to be freed from the vat of bubblegum by people chewing their way through the gum.
The man who worked in the gum factory fell in a vat of bubblegum . His boss had to chew him out .