That's because, bafflingly, it uses a local directory-cache for files. Think of it as the "Downloads" folder for a browser. Any time you upload, Teams will try to save it to your local cache first; if it finds the old file, it will whine like that.
Any time you want to upload a file, you should really not do in Chats but in Channels, which have a separate area for each Channel (backed by Sharepoint). Except in some companies (like where I'm now) people for some reason use Chats almost exclusively instead of Channels, so the whole thing becomes awkward: go to the channel, upload, get the link, paste the link in chat.
I guess it could be worse, it could be AOL.