Abram was given the land of Canaan.
If God gave me a house, I would be thankful and overjoyed.
But what if someone was already living in the house? What if there was a famine where the house was and there wasn't any food? Well, we might start looking for solutions to those problems, and we probably wouldn't just move right into the house.
That's what happened with Abram. Instead of immediately settling in Canaan, he kept traveling and headed to Egypt to find food. Maybe God had an amazing plan to provide for Abram had he stayed, but he missed it because he tried to solve those problems himself.
In Egypt, Abram also let his fear of the future lead him into sin. He lied about his wife being his sister because she is pretty and he thinks someone might kill him to get to her. He let Pharoah have his wife, and then he didn't have any way of getting out of this trouble.
God knew Abram had a mess on his hands. So he plagued Pharaoh's household. It says "God touched Pharoah so he couldn't touch Sarai." He gave Pharoah a disease so he didn't want to get intimate with her. He gave her back to her husband.
So Abram went back to where God had originally told him to go. He had too much stuff and have away part of his land to his nephew. And think about what he had to deal with from his wife after he gave her away to another man. Plus, Sarai eventually have her Egyptian maidservant --- who wouldn't have even been there had they not gone to Egypt --- to her husband so she could have a baby. There were a lot of issues that came about because Abram didn't immediately obey as he should have.
Sometimes we don't immediately obey. We question the gift of the house because it doesn't seem perfect. But if we just listen, God will work it out. And if we do make a mistake, we go back, go home and trust him to deal with the problems. He is so much bigger than we think.