I would try copying one of the files into another empty work folder. Then open it up to make sure it is what you think it is. Now try to copy the second file to the work folder. Does Finder complain about a file with that name already existing? If it doesn't, there must be a hidden difference in the names. If it does, I would guess that one of the original files was written to disk without using macOS's (or Finder's) routines, thereby bypassing the usual name check. (Under the hood, the file is identified by its location rather than its name, isn't it? Having two Jill Smythe's on the same street doesn't cause a postal system breakdown as long as they had different house numbers.)
It seems to me that I have seen this occasionally (rarely). I verify that one is 'real' and complete, and then delete the other, lest some otherwise 'well-behaved' program freak out over it and do something destructive.
BTW, do the two files have the same dates and other metadata? I wonder what would happen if you opened one GIF in an appropriate editor, made some minor change and then undid the change and tried to SAVE the file. It would have the same data, but a new Modified date. If that goes through without a hitch, what would happen if instead of SAVING the file you used SAVE AS, and used the (apparent) name of the other file? (I would expect you now to get an OS complaint.) Anyway, it's kind of fun to fool around with these oddities to see if any patterns emerge.