Files having same name but different content overwrites. Even though content of both files are different new file overwrites old one …content of old file gets replaced with content of new file.
Which version are you using? Based on what DocType do you upload the files?
In general, there is a build-in functionality that will add a hash-suffix to the file, if any duplicates occur.