These are called onomatopoeias. Every language on the planet recognizes them. The very first human speech was composed heavily of them.
As noted by Paulie_D in the comments, they originated in the print comic version of the cartoon.
Taking a step deeper, culture historian Tim DeForest credits cartoonist Roy Crane for being the first to use them in comics:
It was Crane who pioneered the use of onomatopoeic sound effects in
comics, adding "bam," "pow" and "wham" to what had previously been an
almost entirely visual vocabulary. Crane had fun with this, tossing in
an occasional "ker-splash" or "lickety-wop" along with what would
become the more standard effects. Words as well as images became
vehicles for carrying along his increasingly fast-paced storylines.
Onomatopoeias have a certain psychological effect. For this reason they are also used heavily in advertising (think snap, crackle, pop). They are good way to express a sound or feeling in text. They sound cheesy to a modern person because they're not used in video anymore, but back before modern sound effects became ubiquitous these psychological effects were much more prominent. Today every modern action movie uses equally cheesy and unrealistic sound effects instead of Onomatopoeias, but most modern moviegoers don't even notice them. Perhaps in the future someone will ask why do all these old movies have super cheesy sound effects?