You've got the main idea correctly: if you fear that your ISP would sniff or manipulate your traffic then a proper VPN will protect you against this. But then you have to trust the VPN provider instead. Only that you often have more choice in choosing a VPN provider than an ISP and that VPN providers might actually want to excel in terms of privacy while your ISP might have different interests.
But note that a VPN might protect you less than you think, i.e. watch out for IPv6 leaks or DNS leaks caused by improper VPN implementations or configurations.
I have read that using a vpn can prevent hackers ...
The VPN provider can only protect your connection between the VPN entry (usually your system or your local router) and the VPN exit. The VPN exit is usually not the endpoint of your connection, i.e. there are still MITM attacks possible between the VPN exit and the site you visit. And a VPN will also not protect you against a malicious or otherwise insecure web site. But you've bypassed at least your ISP and if the VPN exit is outside the reach of your government you increased your chance to bypass your government too (as long as the trust in the VPN is actually justified).