Because other witnesses testified that the band played ragtime airs and other secular music as well during the sinking. It has never been definitively proven that the ensemble played "Nearer My God to Thee."
But I agree that is makes for a much more poignant story.
I even have a CD from the era which has all the songs the band played as mentioned by Titanic survivors.
The ragtime songs dominate the beginning of the CD though of course there is no way to reconstruct the exact sequence with 100% accuracy.
Well, how do we know they played anything at all? It could have been a lie worked out by the survivors.
My guess is that they DID play NMGTT, but it may or may not have been the last thing they played.
Les sanglots longues des violons de l’autumne;
Blesse mon coeur, d’une langeur... ... ... monotone.