How did Minecraft's Java/Bedrock split come to pass?

Originally Minecraft (built on Java) was released by Mojang in 2009, for computers that supported Java. In 2011 Minecraft Pocket Edition (PE) came out for mobile devices, which was built on Objective C and C++ instead of Java.

In the following years, versions of Minecraft for Xbox and PlayStation came out, which also used the same underlying languages as Pocket Edition. However, each were completely separate codebases, and had different levels of support.

In 2017, three years after Microsoft bought Mojang, they decided to re-implement (re-code/rebuild) Pocket Edition, Xbox, and PlayStation versions of Minecraft to make them all identical. Not every platform can run Java, but all of them could use C++, so they decided to combine them making "Minecraft Bedrock" to keep it simpler. They also released Minecraft Bedrock on to PC as well, in case you wanted to play with your friends on console or mobile.

Java Edition has a lot more features and options with Mods and servers than Bedrock, which is why PC players prefer Java over Bedrock.

So basically the reason for the Java/Bedrock split is because console and mobile can't run Java, so they rebuilt the game in a language that can be built for every platform.