Only one person can be involved in a personal union (hence the name). The trouble with being in a personal union – that is, sharing your monarch with a different country – is that your singular monarch might make choices that serve the other country's interests at the expense of your own.
Mary held the Hungarian crown after her father's death – her sister did not. By choosing Mary, Poland would have had a monarch who held the crown of both Hungary and Poland, which is what constitutes a personal union.
By choosing Jedwiga instead, they gained a monarch who did not already hold any other royal title. As a result the crown of Poland was held by one person, and the crown of Hungary was held by another, preventing a personal union (of two royal titles held by one person) of Poland and Hungary from occurring.
Of course, the monarchs of the countries were still related, but two sisters can have differences of opinion, and can better serve the interests of their separate countries as separate countries. And yes, it may have meant that Mary or Jedwiga were theoretically in line for each other's throne, but the personal union was broken for the time being, and in practical terms one or both would have soon had heirs who would have put new entire family branches between the thrones.