VPN commonly only hides your IP for the time you're using it. There are many other factors that can be used to track you.
First is cookies. Say you log in to Facebook with your browser from your own IP address and a hour later you fire up VPN to browse the web. One of the websites you load has Facebook's tracking pixel and - unless you cleared your cookies - boom: Facebook knows you have visited that site.
Even if you clear your cookies, you may have some long-living stuff (like Flash cookies etc) that can be used to track your browser.
And even if you clear everything or use incognito, sites can use some clever heuristics (CPU power, enabled plugins, timezone, browser version, webrtc, etc.) to track your browsing and to match that it's you.