As goodbunnystudio so aptly put it, your assumptions about copyright law are not quite correct.
If you are making a fan game (what we would call a derivative work), as far as copyright is concerned it does not matter if you are selling it or not. What matters is whether or not it's authorized by the copyright holder, and if it isn't then the copyright holder has the right to request the infringing work's removal from platforms.
This includes, for example, fan art. Yes, most fan art is not authorized and copyright owners could request their removal, but almost everyone understands that's silly, rude and a spit on the face of the people who enjoy your work. Companies, for the most part, only use their right to remove derivative content when it's being used for commercial purposes, but keep in mind they could request the removal of non-commercial content as well, if they wanted.
In your case, accepting money (even "pay what you want") could increase your chances of receiving a legally-backed request to remove your game from circulation.