The earliest use of the word title is for an inscription placed by an object (or person, it comes from the Latin titulus and first appears in regards to the inscription "Iesus Nazarenus, Rex Iudaeorum" placed above Christ during the Crucifixion), or a placard in a theatre giving the name of the play currently being shown.
From this another early sense is of the inscription at the top of a chapter or section, or on the cover or title-page of a book.
Now, the title in this sense would of course also be used as the name of the book should one wish to refer to it, or at least we might create a name for it by abbreviating the title (e.g. the book with the title The Life and Strange Surprizing Adventures of Robinson Crusoe, Of York, Mariner: Who lived Eight and Twenty Years, all alone in an un-inhabited Island on the Coast of America, near the Mouth of the Great River of Oroonoque; Having been cast on Shore by Shipwreck, wherein all the Men perished but himself. With An Account how he was at last as strangely deliver'd by Pyrates is best-known by the name "Robinson Crusoe").
Increasingly, as short titles became more common, the title and name of a book is almost always the same.
There are some exceptions, e.g. "K&R" and "The White Bible" or both names for the book with the title The C Programming Language (which is also a name for it), "The Camel Book" is a name for Programming Perl, and so on. Among Star-Wars fans, "Empire" is recognised as a name for the film that has been released under the titles The Empire Strikes Back and Star Wars Episode V: The Empire Strikes Back. Some songs are known by names other than their titles, particularly from choral lines.
As such, even in those cases you mention as more often having titles than names, the two are overlapping but not identical; such works may have more than one titles, and then my have yet further names again.
But for all that, it's still the case that the title will almost always be a name, and often recognised as the "real" name.
"File name" is a slightly more complicated case. The concept goes back to the Compatible Time-Sharing System and "file title" could have arguably have made just as much (metaphorical) sense. In retrospect the jargon chosen works well with the distinction I describe above though, since hierarchical file systems, multi-host systems and aliasing all mean that there is more to the name(s) of a file from a given position in the system than just the title given to it.
And so, a title is what someone has associated with something through printing it on or near them, or otherwise formally asserting is the name, while name is wider again and refers to anything it has been formally or informally referred to. By extension, it also applies to where this would often be done even if it never was (a picture with no plaque, a song for which the music or lyrics have never been printed).
In those cases where the name is also the title (hence films, books, songs, chapters, etc. with the caveat about other names already mentioned) we favour the more specific title over the more general name, to the point of this being more idiomatic.
(Title in the sense of e.g. an honorific or an hereditary title is another case again).