The Messenger of Allah ﷺ said, "A prophet from among the prophets once stopped to rest beneath a tree, and an ant bit him. He ordered his belongings to be removed from under the tree, then commanded that the ants' nest be burned with fire. Allah revealed to him, 'Why not just one ant?'"
أن رسول الله ﷺ قال: نزل نبي من الأنبياء تحت شجرة فلدغته نملة. فأمر بجهازه فأخرج من تحتها، ثم أمر ببيتها فأحرق بالنار فأوحى الله إليه: فهلا نملة واحدة.
Bukhari related it in "The Beginning of Creation" (3319), and Muslim in "Greeting" (1224:149), both through Abu Zinad, from Araj, from Abu Hurairah, who narrated it. Muslim also transmitted it through another route, from Hammam bin Munabbih, from Abu Hurairah, in similar wording. The name of this prophet is not known with certainty. His statement, "he ordered that his gear be prepared," means his belongings.