In a world with consoles. Java needs a JVM, and those aren’t typical with things like the Switch (2 soon), PS5, and Xbox Series (half the alphabet).
C++ is generally more performant than Java.
https://programming-language-benchmarks.vercel.app/java-vs-cpp
What’s that got to do with making things cross platform? Java programs only need to run in a Java runtime environment of which there’s one for basically everything. If you make something that runs in a JRE, it’ll be able to run on any device with a JRE that’s up to date for it.
Minecraft Java runs like dog shit. Making a faster port of it was worth it. They just botched it because Microsoft got its hands on it.