Ben Zimmer, writing for Slate looks at the history of @#$%! and how it came to represent swear words in comics.
In a 1964 article for the National Cartoonist Society, Beetle Bailey creator Mort Walker coined the term grawlix, which, after a bit of evolution in its meaning, now refers to the string of typographical symbols that sometimes stands in for profanity. Anger is a fruitful comedic trope, after all, and so the quandary must have arisen for early cartoonists: How to depict that emotion without actually swearing, which is obviously inappropriate for the Funny Pages.
The earliest example comes the Katzenjammer Kids stip.