Why did Joseph store grain during the seven good years?
Joseph stored grain during the seven good years to carry the world of that time through the seven years of famine. During the seven years of good production, he piled up grain and foodstuffs so that the stored supply would see the people through the coming years of famine.
Les explains that Joseph had been sold into Egypt earlier, and during the seven years of good production he piled up grain and foodstuffs. The purpose was to carry the world of that time through the seven years of famine that followed. Because of the famine, Jacob and his twelve sons and their families eventually ended up down in Egypt, as the context notes.