Yes, VPNs are legal in most countries around the world, including the US, Canada, and most of Europe, as long as you don’t do anything illegal while using one.
However, countries that enforce online surveillance and censorship may restrict VPN usage or ban VPN services altogether. For example, VPNs are illegal in North Korea, Belarus, Oman, Iraq, and Turkmenistan. Other countries, like Russia and China, heavily restrict the use of VPNs.