What is the origin of "cross country skiing"?
Etymology online gives the following elucidating definition:
also cross country, crosscountry; 1767, of roads, from cross (v.) + country, or aphetic for across-country. Of flights, from 1909.
i.e. It does not refer to movement across borders of countries, but rather across a single country (at some scale).
So, "cross-country skiing" can basically be interpreted as "skiing across [significant] terrain". Specifically, it does of course involve a very specific technique, different to that of downhill skiing. Analogies can be made with "cross-country running" as well.
It's using the term cross-country not in the sense of national boundaries, but open countryside. Basically, it means skiing through fields, pastures, open range, whatever. It is contrasted with downhill skiing in which skiers follow a (usually) prepared track down a mountainside.
What is the origin of that phrase, which is not really referring to skiing through countries?
The phrase isn't referring to a political country, but country in the sense of the "outdoors" -- the rural area outside of cities and towns. It is the same sense as such phrases as country roads, back country, Country and Western music, etc.
Cross-country skiing refers to skiing which historically took place across significant stretches of rural landscape, rather than up and down one hill or mountain (downhill skiing). The phrase has been applied to this technique of skiing even if it takes place on a well-groomed city track or trail.