I've heard about how jazz pianists can improvise a lot better than classical pianists, who focus on mainly technical aspects of a piece. What exactly is the difference between the two?
I think most answers to this will contain quite a lot of subjectivity. For what its worth here is my take on this.
Most jazz does not involve detailed written out music. There are musical instructions expressed in a variety of ways and the performer acts on those instructions to create the music. There is a lot of improvisation involved based around those instructions. Its an impressive skill when done well. Two different performances of the same piece could (and often do)easily sound very different.
Most (but not all) classical music comes in the form of written out music with detailed instructions of how to do pretty much all of it. There is still some "interpretation" to do but this is at a very detailed level (e.g. phrasing, rubato) and it does not really count as improvisation. Two performances of the same piece will still be different but they will (or should) be the same notes played in the same order.
Having said that there is a tradition dating back to the baroque period of classical performers improvising. There are stories of people like Bach, Handel and Mozart being given a tune and simply sitting at a keyboard and improvising variations on that tune for (sometimes) hours. Not the same as jazz improvisation of course but it still requires a high level of musicality to do well.
Most well-known pianists tend to do either classical or jazz although a few (Andre Previn comes to mind) were comfortable in both styles. The skill levels involved for both styles, especially at the very top end, are immense. There is a story - which I am happy to believe - that Rachmaninoff (considered by many to be the best classical pianist of his generation) considered Art Tatum to be at least as good as he was.
Like I said - subjective.
Hope that helps.
I want to expand on @JimM's answer.
Classical improvisation was just something the well known greats like Bach, Handel and Mozart did. (Not that @JimM meant that.) Below are some examples from the partimenti tradition of the 18th century that show just how elaborate the improvised detail could be when a keyboardist played extemporaneously from only a notated bass line!
...a few of the suggested styles...
In my opinion that level of elaboration is equal to what a jazz player does from a lead sheet.
That kind of 'classical' improvisation died off in the 19th century when the focus shifted to the concert virtuoso.
Jazz harmony can be studied - but not the groove. If one is grown up in classical "language speaking" he will always keep a classical "accent" that he can't hardly lose. It takes a lot of time to aquire the feeling for the right groove.
In music, groove is the sense of propulsive rhythmic "feel" or sense of "swing"
So I'd say the lack of groove - the missing feeling for the specific rhyhtm in jazz - by many classical educated pianists is the biggest difference.
(Eventhough top classical pianists will play Bach and also other baroque composers with a slight touch of swing.)
The expression "in the groove" (as in the jazz standard) was widely used from around 1936 to 1945, at the height of the swing era, to describe top-notch jazz performances. In the 1940s and 1950s, groove commonly came to denote musical "routine, preference, style, [or] source of pleasure."
Another difference may be that many classical pianists are stuck on sheet music. I don't think about professional players now!
How often can we hear: "Yes, I know this piece but I don't have the sheet music with me." An amateur jazz pianist will always be to play and improvise about a theme.
It is simply a different focus. Jazz pianists study and practice the art of improvisation and the classical pianists study and practice the art of performing pre-composed music. Jazz pianists have more practical and sort of 'applied' but also very deep grasp of harmony and develop a vocabulary of phrases to express themselves in improvisation. I think the reluctance and sometimes inability of classically trained musicians to improvise comes from the fact that they start training at early age and quickly form habit of playing only from the sheets. There might be a mental barrier when it comes to playing "from a top of your head".