Here’s my analogy:
A project manager makes sure the trains run on time.
A product manager sets the destination and the places you call at on the journey.
Both roles are important.
As complexity and dependencies increase, say in a bigger company, it helps all involved if you have different individuals performing these roles.
Side note:
Some companies have program managers instead of project managers.
‘Programs’ are usually bigger than an individual project but for simplicity, you could use the terms interchangeably here.