Hilbert derived general relativity 5 days before Einstein [1]. Einstein won the public relations difference because his previous work.
It was that close.
Recall Hilbert was vastly better at the math, and was catching up leaps and bounds on Einsteins intuition at the time.
Dozens of others were also close. Minkowski, Cartan, Poincare, all were doing the same stuff, trying to unify the same items.
So had Einstein done nothing, many others were immediately going to reach the same results.
[1] https://en.m.wikipedia.org/wiki/General_relativity_priority_...
Recall at this time Hilbert was a god in mathematics, and one of the best that ever lived. He did groundbreaking work in n many areas of math and physics.
Of the two, each left alone, it's far more likely Hilbert would have arrived first. Working while corresponding likely made Einstein much faster and Hilbert slightly faster.
Einstein took 8 years to work out general relativity. Hilbert started working on physics in 1912 and by 1915 had gotten to where he was deriving general relativity. The speed he worked in physics and the broad range of topics he influenced in physics far outshines Einstein. Hilbert famously said physicists don't know enough math to do physics. He was right at that time - his math mastery let him plow through physics much faster.
To see the scope of things attributed to Hilbert versus attributed to Einsteins simply look over their Wikipedia pages.
This is just not true. Einstein's earliest GR work is a collaboration with Marcel Grossman. Hilbert's work is so close and overlapping that it takes quite a bit of effort even to verify that Einstein's work was genuinely independent.
I think the most profound work in mathematical physics of Einstein’s generation was done by Emmy Noether and Einstein thought so too.
Her trail really induces modern physics as we no it.
Hilbert? (I don't actually know.)