Etymology of Legalism goes back to the mid 1800’s about the time the word fundamentalist was surfacing as we know it today. Legalism was used in disdain to biblical standards, and is illegitimately thrown around today as a hateful word, and false accusations that standards are a part of our plan of salvation.
Simply put, legalism is obedience and conformity to a law, while liberalism is disobedience. Man’s law, for example, says don’t speed. God’s law says to obey man’s law when it does not violate His law. So staying within the speed limit is defined as legalism, while speeding is liberalism. Then comes the word liberty which allows us to go whatever speed we want, but within the bounds of legalism.
Liberals have redefined the biblical definition and use of both liberty and legalism to excuse their going outside the bounds of God’s law.
Putting these terms into our political landscape, for example, we would be a legalist because we stick by the law as established by the US Constitution. Hence, why the opposition to the Constitution and rule of law are called liberals, because they want to be outside the bounds of the establishment of law and order — they defund the police, they open the borders, they free criminals, while all along criminalizing the legalists for simply standing where we always have.
So, obedience to biblical standards is to be a legalist, not unto Salvation as they accuse, but unto sanctification as God commands the born-again believer to be holy. Hence, why we call them a liberal.
What one is obedient to makes them either a liberal or a legalist, a criminal or a law abider. There is nothing else, not even fence riding. We do have liberty (or preferences), but this can only be found within the bounds of the strictness of the law, or legalism.