It works because so many academic journals are write-only media. The only things that actually "read" the papers are machines that check for plagiarism, compute citation counts and do other things used to decide on academic promotions. So it doesn't matter if the text is nonsensical.
And the tools work for spam, the original use case, because people who want to buy Viagra from spam mails don't care if they have to read weird English, they just want to find the web shops. Works great for bypassing keyword and Bayesian filters though.
Some papers show signs of being generated by context-free grammars or random phrase combination as well.
These papers are often being produced by "paper mills" that bulk generate fake studies and sell them to academics, who use them to get promoted without having to do any real research.
I wrote an article about the problem years ago if you want to learn more:
https://dailysceptic.org/2021/10/03/436-randomly-generated-p...