"These are the generations of Noah; [Noah was a righteous man]" (Genesis 6:9). Why is "Noah, Noah" said twice? Because his children were righteous like him. Rabbi Acha bar Ze'era said: Would you say that the children of Noah were righteous? For the generation of the flood were born into wickedness. Just as a man would go upon a woman who was not his own, so too the beast would go upon another species that was not its own. And from where do we learn that the beast was commanded not to go upon a species that was not its own? As it is said, "And God made the beast of the earth after its kind" (Genesis 1:25). The Holy One, blessed be He, said: With your own kind you are permitted to be joined; with another kind it is forbidden. But the cattle, the beasts, and the birds that entered the ark were righteous, for they had not joined with another species, but only with their own kind. Rabbi Pinchas the Priest, son of Chiyya, said: For thus it is written, "They went forth from the ark according to their families" (Genesis 8:19). And do beasts have families, that it says "according to their families"? Rather, those that had joined only with their own kind merited to enter the ark.
Why the Torah Says Noah Twice and the Beasts Who Kept Their Kind
Midrash Tanchuma Buber, Noach 5:1
אלה תולדות נח [נח איש צדיק]. למה שתי פעמים נח נח, שהיו בניו צדיקים כמותו, אמר ר' אחא בר זעירא אתה אומר בניו של נח צדיקים היו, לפי שהיו דור המבול ילודים ברשע, כשם שהיה אדם הולך על אשה שאינה שלו, כך היתה הבהמה הולכת על מין אחר שאינה שלה, ומנין שנצטוות הבהמה שלא תל על מין שאינה שלה, שנאמר ויעש אלהים את חית הארץ למינה (בראשית א כה), אמר הקב"ה במינך את מותרת לדבק, במין אחר אסור, אבל הבהמה והחיה והעוף שנכנסו לתבה צדיקים היו, שלא נדבקו במין אחר אלא במינן. אמר ר' פנחס הכהן בר חייא שכך כתיב למשפחותיהם יצאו מן התבה (שם ח יט), וכי יש לבהמות משפחות שהוא אומר למשפחותיהם, אלא אותן שלא נדבקו אלא במינן, זכו להכנס בתבה.