As far as I can remember the origins of Bedrock are the original console releases which couldn't ship a JVM. So a whole new codebase was developed, and ultimately it was more performant as it had to run on 7th gen consoles.
Console releases were done by a different studio originally, 4J Studios. Bedrock spawned from the mobile ports, and eventually replaced the console editions and had different features.
Java edition still horribly underperforms. It’s mostly single-threaded and even if they’ve rewritten the lighting engine a few times (those decade old black-block bugs disappeared), the Sodium family of mods show you how much it can be improved.