Python and (especially) R already had a lot of packages before Javascript came to the server. So for a large part its momentum. I don't suspect there is much overlap between web developers and machine learning researchers, so they start from scratch, and obviously pick the dominant one.
But to ask the reverse: why would JS be big with machine learning and data science?
The advantage of Javascript is availability in the browser (and so people who like to write a single language use it on the server), and it has event stuff built in. Not really helpful for ML.
But even beyond that, it's a much less consistent language than Python with many weird quirks, it has no relevant ecosystem (except maybe charting), even numjs is new and nowhere near numpy.
I suspect that since ML is performance-sensitive, if it does come to the browser now, it's going to be mostly WebAssembly.