It was wired incorrectly.
Someone wired it that way so a utility (like a lamp) could be controlled by the wall switch.
That's pretty typical of usually older wiring. Years ago, why would you want to have a live outlet in a bathroom unless the light was on---there wasn't a lot of battery operated stuff that had to remain plugged in, and your electric razor had to be plugged in when you used it and you used that with the light on.
I replaced my light switch in an apartment that was about 50 years old with a combination switch and wire plug and wired the plug to be constantly on and the switch controlled the original plug and light.