Real(ism) is the antonym of Ideal(ism) - Idealism not on todays sense of, basically, do-gooderism, but as the notion that the world is made of, and influenced by, ideas, i.e. thoughts and reasons.
A "Gymnasium" (not to be confused with the English "Gymnasium", although it's the same greek word. A German "Gymnasium" is a secondary school) would usually follow the humanist idea of "Perfektibilität", the idea that you can achieve virtue of character by way of education - which due to some fascination with old Greece meant mostly languages and rhetoric (the concept of virtue was based on the greek notion of arete). That's basically an "idealist" idea.
A Realschule, in contrast, would teach you e.g. how to manage your salary, how to grow a garden and what herb goes well with the chicken. This was intended to be "real" not so much in the salt-of-the-earth sense, but quite literally as in that these were things you could touch with your hands (the concept also proved to be a winner, as Prussia soon allowed Realschule graduates in public service, maybe in deference to the fact that knowing how to manage a garden is sometimes more useful to the public enterprise than possessing arete).
Realpolitik follows basically the same pattern - the idea originally was that it is virtuous to have enlighted goals, but that the quickest way to bring them about is by using a big stick (although in some quarters the meaning has changed today to thinking that you should not have high-minded goals at all and just have the stick).
The oppositon of Idealism and Realism/Materialism was for quite some time the driving force behind most of German philosophy. Of course, these days philosophers do not have much clout in Germany, so this is not something that is hugely in our mind when we use the prefix "real" - it often simply means "practical", possibly at the expense of some noble intentions, or else that a seemingly good thing falls shorts of some actual goal (i.e. "Reallohnverlust", the fact that people can afford less even with nominally higher wages).