Sahih Bukhari 2324
To be Sahih al Sanad (authentic) does not mean a hadith is correct too. A hadith is judged for its chain of narration and for its text which should not go against intellect, the Quran, established historical facts, etc. The details are there in the book of Uloom ul Quran. There are two possibilities about the above-cited hadith. It is allegorical to tell some simple lessons or it is narrated from Israelite stories because Abu Hurairah sometimes ascribed narration from Israelites to the holy prophet.