VPNs are legal, and they are consistently used by individuals and companies around the world to protect their private information and online activity, including in countries with highly restrictive governments. Even where VPNs are seen as discouraged, many governments tacitly endorse their use by officials, academics, or business leaders as a necessary measure to stay competitive in an interconnected world. It is not practical for any country to ban all VPNs.
Having said that, illegal online activity remains illegal, whether you are using a VPN or not