The story in question is described in [Saint John of Damascus' writings](https://archive.org/stream/fathersofthechur009511mbp#page/n209/mode/2up), which I will quote here:

> Then there is the book of *The Camel of God*. About this camel [Muhammad] says that there was a camel from God and that she drank the whole river and could not pass through two mountains, because there was not room enough. There were people in that place, he says, and they used to drink the water on one day, while the camel would drink it on the next. Moreover, by drinking the water she furnished them with nourishment, because she supplied them with milk instead of water. Then, because these men were evil, they rose up, he says, and killed the camel, which, he says, when the mother had been done away with, called upon God and God took it to Himself.

This story is not in the Qur'an, but it appears to be referencing the [camel](https://en.wikipedia.org/wiki/She-Camel_of_God) that the prophet Salih presented to the people of Thamud as a sign of Allah:

> * You are but a man like ourselves, so bring a sign, if you should be of the truthful."  
> * He said, "This is a she-camel. For her is a [time of] drink, and for you is a [time of] drink, [each] on a known day.  
> * And do not touch her with harm, lest you be seized by the punishment of a terrible day."  
> * But they hamstrung her and so became regretful.
>
> <sup>&mdash;[Ash-Shu'ara' 154-157](https://legacy.quran.com/26/154-157)</sup>

I don't know where the extra details came from, but it was not uncommon for the lives of the previous prophets to be compiled into such stories and propagated, based on any number of sources both authentic and dubious, including stories and legends from the Israiliyyat and Jahiliyyat.

I think it's important to note that [John of Damascus](https://en.wikipedia.org/wiki/John_of_Damascus) lived about a century before [Muhammad al-Bukhari](https://en.wikipedia.org/wiki/Muhammad_al-Bukhari) compiled [his famous Sahih](https://en.wikipedia.org/wiki/Sahih_al-Bukhari) and modern hadith sciences were born. Outside of the Qur'an itself, anything that claimed to be the direct words of Muhammad should probably be taken with a grain of salt.