Technical reasons? Not really. But human/political reasons definitely. The history of JavaScript is a great yarn, both Eich and Crockford tell it pretty well (https://www.youtube.com/watch?v=t7_5-XYrkqg and https://www.youtube.com/watch?v=Rj49rmc01Hs) and it should give an idea of the sort of games that were being played.
From an author's point of view - the web was created in the early days by a ton of people, only a handful of whom were Serious Programmers(tm) who liked Java. You can write a few lines of HTML and JavaScript in a text file, run it in a browser and it works. That was never the case with Java and there may not be much reason beyond that. Barring the obvious one, that most web people I know hate writing Java as much as Java people hate writing JavaScript.
As a sidenote I think ease of use also played a huge part in PHP's success, because it was so commonly installed on web servers you could just rename your .html files .php and suddenly you could do new and awesome tricks! ;) People didn't care about the purity of language, they were too busy making stuff in the crazy wild west of the web.
The funny thing of course is that JavaScript gets more like Java all the time, in ways both superficial and substantial. Most React projects don't run in the browser, the source code has to be converted into something that runs in the browser.
Which is basically where Web Assembly comes in - if you're transpiling into a target language you basically never see, why not make that language faster?
I don't see the average author writing things directly in wasm; although I will probably be wrong ;) I think we're entering a period of time where people will write whatever language they like and transpile it into JavaScript (and eventually wasm) during deployment.
To put it another way: nobody who hates JavaScript has to write it any more, so it barely matters why Java didn't "win". Anyone who wishes Java won can still write Java for the server, or find some flavour of x-to-javascript that suits them.