The 400 years and the four generations are not the same time periods, but they do fully overlap. The additional time period which overlaps both the 400 years and the four generations is that of the 430 years referenced in Exodus 12:40-41:
"Now the sojourning of the children of Israel, who dwelt in Egypt, was
four hundred and thirty years. And it came to pass at the end of the
four hundred and thirty years, even the selfsame day it came to pass,
that all the hosts of the LORD went out from the land of Egypt."
(Exodus 12:40-41)
What challenges many people in understanding these passages, ironically, is the definition of "Egypt." At its zenith, during the times of Abraham, "Egypt" was a vast empire that included the lands of Canaan and Israel as well. It afterward got smaller, and by the time Jacob took his family to "Egypt", he "entered" a much-reduced territory which still pertained to Egypt--entering from what, in his grandfather's day, had been part of Egypt as well. In a sense, then, the family, which had already been in Egypt, "re-entered" the land, even though they had never actually left that territory from the time of Abraham onward--its political boundary had simply receded from them.
With that in mind, let's look more closely at the times again.
The 400 Years versus the 430 Years
To Abraham had been given the promise:
And he said unto Abram, Know of a surety that thy seed shall be a
stranger in a land that is not theirs, and shall serve them; and they
shall afflict them four hundred years; And also that nation, whom
they shall serve, will I judge: and afterward shall they come out with
great substance. (Genesis 15:13-14)
When was Abraham given this promise? He received this promise before he had had any children, so the clock on the four-hundred years' prophecy could not possibly have started yet. In fact, this was a special promise to Abraham because it confirmed to him that he would have a child.
How old was Abraham when he entered "Egypt"?
Now the LORD had said unto Abram, Get thee out of thy country, and
from thy kindred, and from thy father's house, unto a land that I will
show thee: And I will make of thee a great nation, and I will bless
thee, and make thy name great; and thou shalt be a blessing: And I
will bless them that bless thee, and curse him that curseth thee: and
in thee shall all families of the earth be blessed. So Abram departed,
as the LORD had spoken unto him; and Lot went with him: and Abram was
seventy and five years old when he departed out of Haran. (Genesis
12:1-4)
It was at that time, when Abram was 75 years old, that, having left Haran, he entered "Canaan", at that time annexed by Egypt. So the 430 years' reference dates from Abraham's entry into Egypt.
How old was Abraham when he had a son?
"And Abraham was an hundred years old, when his son Isaac was born
unto him." (Genesis 21:5)
So, his "seed" (Isaac) was born to him 25 years after his entry into "Egypt". But when did the affliction or bondage begin? It did not begin yet when Isaac was too young to be exposed to anyone much beyond his mother's arms. But when Isaac was five years old, a weaning party was held for him:
"And the child grew, and was weaned: and Abraham made a great feast
the same day that Isaac was weaned. And Sarah saw the son of Hagar
the Egyptian, which she had born unto Abraham, mocking. Wherefore she
said unto Abraham, Cast out this bondwoman and her son: for the son of
this bondwoman shall not be heir with my son, even with Isaac."
(Genesis 21:8-10)
Notice that Isaac was bullied by "the son of Hagar the Egyptian." As Abram had been sojourning in Egypt, the hired maid whom Sarai had given him for the role of surrogate mother, had been Egyptian. And it was at this point that the prophecy's 400 years began, for at this point the "affliction" part had begun. The years of "bondage" were yet future.
The Four Generations
"And God spake unto Israel in the visions of the night, and said,
Jacob, Jacob. And he said, Here am I. And he said, I am God, the
God of thy father: fear not to go down into Egypt; for I will there
make of thee a great nation: I will go down with thee into Egypt; and
I will also surely bring thee up again: and Joseph shall put his hand
upon thine eyes." (Genesis 46:2-4)
During the famine, when Jacob, at Joseph's special invitation, had brought all of his family into "Egypt," the count began on the four generations. We can see those generations recorded in the Bible. While all of Jacob's sons are mentioned, we'll follow the line of Levi:
"And these are the names of the children of Israel, which came into
Egypt, Jacob and his sons: Reuben, Jacob's firstborn. . . . And the
sons of Levi; Gershon, Kohath, and Merari." (Genesis 46:8,11)
"And these are the names of the sons of Levi according to their
generations; Gershon, and Kohath, and Merari: and the years of the
life of Levi were an hundred thirty and seven years. . . . And the
sons of Kohath; Amram, and Izhar, and Hebron, and Uzziel: and the
years of the life of Kohath were an hundred thirty and three years.
. . . And Amram took him Jochebed his father's sister to wife; and she
bare him Aaron and Moses: and the years of the life of Amram were an
hundred and thirty and seven years. . . . These are that Aaron and
Moses, to whom the LORD said, Bring out the children of Israel from
the land of Egypt according to their armies. These are they which
spake to Pharaoh king of Egypt, to bring out the children of Israel
from Egypt: these are that Moses and Aaron." (Exodus 6:16, 18, 20,
26-27)
And Moses was content to dwell with the man: and he gave Moses
Zipporah his daughter. And she bare him a son, and he called his name
Gershom: for he said, I have been a stranger in a strange land.
(Exodus 2:21-22)
Summarizing those verses we have:
Jacob --> The patriarch who brought his children and
grandchildren to "enter" (re-enter) Egypt;
Levi --> Entered Egypt, Jacob's son;
Kohath --> Entered Egypt, the first generation,
Levi's son;
Amram --> The second generation, Kohath's son; and
Moses --> The third generation, Amram's son,
who led the Israelites back out of Egypt.
Gershom --> The fourth generation, Moses' son,
representing the generation brought out of Egypt.
The total time from entry into Egypt to departure in the fourth generation may have been around 215 years--half of the 430-year total from Abraham's first entry to the exodus. But the time for actual hard bondage (slavery) would have been closer to 90 years--just under a century. We know that Moses was 80 years old at the time he led the people out of Egypt, and the Israelites had been in bondage during Moses' entire lifetime at that point, plus a few years before he was born.
Remember, it was not until after the time of Joseph (after the second generation, post-entry), that the slavery had begun--by an Egyptian king who had not known Joseph. In other words, the slavery began during the third generation, post-entry, and ended when the fourth generation departed in the Exodus.
