To understand how a VPN works, it helps to first understand how your internet connection works without one.
Without a VPN
When you access a website without a VPN, you are being connected to that site through your internet service provider, or ISP. The ISP assigns you a unique IP address that can be used to identify you to the website. Because your ISP is handling and directing all your traffic, it can see which websites you visit. And your activity can be linked to you by that unique IP address.
With a VPN
When you connect to the internet with a VPN, the VPN app on your device (also called a VPN client) establishes a secure connection with a VPN server. Your traffic still passes through your ISP, but your ISP can no longer read it or see its final destination. The websites you visit can no longer see your original IP address, only the IP address of the VPN server, which is shared by many other users and changes regularly.