Q. Why did Adam, Avrohom, and Yitzchok have one son who was “bad” and one son who was “good”?
A. “The seed of Israel had been secreted away since before the creation of the world. For two thousand years, G-d ‘was destroying worlds and creating them’ – first in the ten generations wiped out in the Flood, and then in the ten generations scattered by the Dispersion. Thus the world of chaos (tohu) withered away, and the world was rebuilt by Avrohom, where it could be sustained by the covenant of circumcision.
“Now that the time had come for the seed of Israel to be summoned forth in the soul of Isaac, G-d desired that the soul of messiah, which had been hidden away since before the creation of the world (as it is written, ‘and the spirit of G-d hovered above the waters”), should be discovered. For the soul of Messiah was lost in Sodom, as it is written, ‘I found My servant, David,’ and our sages expounded: ‘Where did I find him? In Sodom, in Lot, the nephew of Avrohom.” ~ The ARIZAL.
This is why Avrohom fought two battles on behalf of the people of Sodom, one physical (the war of the Four Kings) and one spiritual (his prayer that the people of Sodom and ‘Ammorrah should be saved if ten righteous souls – not coincidentally, the exact number of people in Lot’s family – could be found there). For Avrohom saw prophetically that the people of Sodom and ‘Amorrah were, in fact, the souls created by Adam during the 130 years he spent separated from his wife, Chava, after their sin, which had been tragically lost in the kelipot when Olam HaTohu collapsed, and which had first been incarnated at the generation of the Flood. Jewish souls were among these lost souls, specifically, the soul of messiah. So Avrohom fought for Sodom twice and, as he had from Nimrod’s fiery furnace, he emerged unharmed and victorious. For it was his son, Yitzchok, who would sire Yaakov, father of twelve completely righteous sons (because the world of tohu had by that time completely withered away).
Now, in the world of Tikkun, Hashem creates du partzufim, or “one thing opposite another”: chochmah opposite binah, chesed opposite gevurah, netzach opposite hod, man opposite woman, good opposite evil, etc.
But in the world of Tohu, the sefirot are separate and discrete, being arranged in a straight column: they do not – indeed, they cannot – interact with each other, or partake of each other’s essence. That’s why Olam HaTohu collapsed. It’s also why Sefer HaBereishis recounts the travails of exceptionally righteous people like Adam and Chava, Avrohom and Sarah, and Yitzchok and Rebecca, each pair of whom had one son who was “good” (emblematic of Olam HaTikkun, that is, Seth, Yitzchok, and Yaakov) and another son who was “bad” (emblematic of Olam Ha Tohu; that is, Kayin, Ishmael, and Esav). These latter were remnants of Olam HaTohu in the Abrahamic line[see note, below], and it took till Yaakov Avinu to have twelve completely righteous (Tikkun-dik) sons, for the remanant of Olam HaTohu to die out in the Abrahamic line.
NOTE: One reason for this is that it was G-d’s will that man have two opposing tendencies: the yetzer hora, the inclination to evil, and the yetzer tov, the inclination to good. In the spiritual world, however, it is impossible to mix or join two polar opposites. That requires physicality. So when Hashem reconstructed the collapsed world of Tohu, he did so in the form of a ladder, in which the two sides of the pairs of opposites came together, where every step shares with and includes within itself every other step, all toward the end of a common goal. At first, when G-d began mixing the inclinations in the Abrahamic line, one child was born good and one child was born bad. This happened twice. But with miraculous birth of Yaakov, one hears the laughter of G-d’s accomplishment, for Yaakov was Tiferet, the harmonious balance between the chesed of Avrohom Avinu and the gevurah of Yitzchok. Yaakov Avinu was the perfect man, whole and complete despite his having both a yetzer tov and a yetzer hora. And it was only from Yaakov Avinu that twelve completely righteous (Tikkun-dik) offspring came forth. And as the ARIZAL said, “thus did the world of Tohu wither away”: Avrohom and his children having built Olam HaTikkun upon its ruins.