The origin of that missile is unconfirmed but there are a few things the consider.
Official Israeli SM accounts posted two videos, at different times, claiming to prove that the attack was a failed missile from within Gaza. In one video the time stamp showed the footage was recorded AFTER the attack, the other video was proved to be from 2022, neither video had any sound. Both were quickly taken down when the errors were identified by SM users.
The IDF then released a recording of a conversation which allegedly took place between two Hamas fighters where they admitted they were responsible. The audio was analysed and I have yet to see anyone report that they thought it was genuine but there are many detailed analyses providing evidence that it was fake.
Many missiles go astray in Gaza and yet we have never heard of one causing so many casualties before.
The hospital in question had been warned to evacuate several times.
Someone who works for Netanyahu's digital media team tweeted about the attack and claimed the IDF was responsible but quickly took the tweet down claiming that they had made a mistake by repeating what had been reported but Reuters, except Reuters had not reported on the attack by the time of the original tweet.
Why would the IDF go to such lengths to fabricate evidence of they had nothing to do with the attack on the hospital?