Someone who practises medicine is a professional.
Someone who practises the piano is still learning.
How have these two apparently opposite senses of the word practise arisen?
The short story is: the "apparently opposite" meanings are in reality not opposite at all; they are merely applied to different spheres.
Dictionary.com on practice:
I put the original meaning practical work in bold. From here, it is easy to derive the two current meanings: practicing the piano is practical work if you want to get better at it; practicing medicine is practical work if you are good at it and want to keep a job. They're just two senses of the same thing. It doesn't require a large stretch of imagination to go from practical work to either current meaning.
There might have been more to it, but if you take etymonline:
the meanings are not really opposite. Original meaning "to perform repeatedly to acquire skill" keeps the meaning of "to perform repeatedly", but changes it slightly to "performed repeatedly and became an expert." This change is explainable by common use of the word.