To some extent the dichotomy is weak. For example, in the US at least, the political appointees, especially for relatively lower positions, tend to be people who first rose to the top as technocrats and then were politically selected. Even at the top, the process in which a person becomes a president or a senator requires passing a test of skill, albeit a very different one. This contrasts with a monarchy where the ruler has to pass no test other than not being revolted against.
From the other direction, I presume that in countries where you have to be part of the party to have any role in government, you at least also have some level of qualification, and they don’t just choose randomly from the party ranks.
I think the real difference is in the incentives the person faces. If they need to compete for votes or for the favour of their superiors, they are, basically, in political business. The person may be an expert, yes, but the incentives force them to care less about technical superiority of the solution and more about whether it’s palatable to the voters/benefactors.
If instead, you are hired to execute tasks that are handed to you by someone else, you can think: “Well, I can try to be cute and try to satisfy my boss’ political preferences, at the expense of the solution, but, on the other hand, he’s going to be replaced sooner or later and I’ll better have a track record of successful execution so that the next person doesn’t fire me.”
The boundary is still blurry, but it at least answers the question about the people who rise as technocrats and are then politically selected: Once you are politically selected, your incentives change and you fall into the category of political appointees.