Ashutosh Jogalekar in The Curious Wavefunction:
David Hilbert (born today in 1862) was one of the greatest mathematicians of the 20th century. He made incisive contributions to a remarkable range of mathematical fields, published a best selling textbook on mathematical methods in physics, laid out a famous list of twenty-three unsolved problems which still challenge the field's practitioners and was a kind of philosophical godfather to at least two generations of mathematicians. Under his influence German mathematics reached its zenith before it was scattered apart by the rise of totalitarianism.
Perhaps less known is Hilbert's friendly and sometimes not-so-friendly rivalry with Einstein. Einstein's two most serious mathematical competitors were Hilbert and Henri Poincare. Poincare came close to discovering special relativity. Hilbert came close to discovering the equations of general relativity. Unlike Einstein, both were men of prodigious mathematical talent. Einstein's own mathematical shortcomings are well known; he had to learn most of the mathematics he needed for cracking open general relativity from friends and colleagues, most notably Marcel Grossmann.
In 1915 Hilbert came very close to publishing the equations of general relativity before Einstein did. Einstein had given a lecture in Berlin on his tentative attempts at formulating the equations. Hilbert was in the audience and doubled his efforts to find the right formulas. In the end Einstein ended up finding the correct form of the equations just a few days before Hilbert. It's quite likely that Hilbert would have gotten there first had Einstein gotten stalled for some reason.
More here.