That’s a really great question, the differences between Postgres and MySQL are varied and subtle.
From a high level perspective while both are technically considered open source projects, MySQL was purchased by Oracle (Sun at the time of purchase) while Postgres has always been more of a community lead effort. That tends to nudge people one way or the other depending on how they philosophically feel about that.
At a low level, Postgres has one canonical storage engine while MySQL has many different storage engines that can be swapped out, InnoDB and MyISAM being the most common.
In terms of querying they are very similar, each follows similar variants of SQL which is why they are so commonly compared to each other.
Here are some other good resources about the differences:
PostgreSQL Vs. MySQL: Differences In Performance, Syntax, And Features
Why I Choose PostgreSQL Over MySQL/MariaDB