Can I solve htb machines through my host?

How would VPN protect you from malicious actors in a subnetwork you’re connecting to? Expecially if it’s the network, you’re specifically accessing using said VPN?