(Replace bar with passwd - I was blocked from submitting my original comment by Cloudflare's WAF...)
It took a bit of time between Microsoft making the temp internet a 'special directory' and AV working properly in the directory, and the browser not saving attacker controlled literals to the filesystem to get past these. Also fun in NTFS because it could cause bluescreens was the AUX, CON, PRNT filenames.
Your post just reminded me of that kind of issue.
Surprisingly, the random text in the program was interpreted as valid program code. I was too young to understand exactly what had happened at the time, but now I understand it's because one of the valid forms of .com programs is a headerless chunk of x86 code for DOS, and I guess that website's output just happened to (a) not immediately crash and (b) invoke the DOS service for printing.
Both have better consumer frontends now (although I remember Deutsche Bahn still recommending this system around 2019), but those systems ultimately get all their data from this one, as far as I'm aware.
(Which also means it's extremely difficult to determine if a .com file really is an executable--there's no signature. It either decodes or it doesn't--and most bytes decode correctly because you want to pack the commands in as densely as possible. Things which will not decode are packing inefficiencies.)
(And back from the Z80 days I remember very carefully crafting assembly code that could be embedded in a BASIC program without causing it to puke. Some commands were unavailable and some values were not permitted--amongst them, zero.)