What to do about fee from publisher for withdrawing unpublished accepted manuscript?
There is wrong on every side of this situation.

First, a journal demanding money for withdrawing a paper is suspicious in the extreme. I have never in my life heard of such a practice from a legitimate journal, which means that you were probably duped into submitting to a predatory (junk) publisher.  If this is the case, you should definitely withdraw the paper and refuse to pay the money, but they may not let you: a dishonest publisher may simply publish your paper without your consent and send you a bill.  If this happens, you can try to fight it, but you may end up needing to withdraw from the other journal instead and simply write off the paper and/or the $500 as a learning experience.

And what will you have learned?


Never dual submit a paper: it is scientifically dishonest, wastes everybody's time, and seriously annoys any legitimate journal.
Never submit a paper to a journal that you haven't thoroughly investigated to determine that it is not a shady fly-by-night predatory publisher.