While the word was still in the king's mouth, a voice came down from heaven, saying, "To you it is spoken, King Nebuchadnezzar: The kingdom has passed on from you" (v. 31). God would teach him to know that he was nothing and the mighty God, the Ruler over the kingdom of men, the One who gives the kingdom of men to whomever He wills, is everything.
According to his nature and his being, Nebuchadnezzar was not a man but a beast. For this reason, his heart was changed from that of a man's, and a beast's heart was given to him (v. 16). God also took away his human reasoning. In that very hour he began to eat grass as bulls, his body became wet with the dew, his hair grew like eagles' feathers, and his nails became like birds' claws (v. 33).
Nebuchadnezzar remained in this condition for "seven periods of time." I believe that this expression refers to seven weeks, to forty-nine days. At the end of these days, Nebuchadnezzar lifted up his eyes to heaven, and his reason returned to him (v. 34a). Because beasts walk on four legs, they look down, but humans walk on two feet and look up. Nebuchadnezzar's reasoning came back as soon as he looked upward toward the heavens. Because he had changed, his reasoning returned.
Nebuchadnezzar blessed the Most High and praised and honored the ever-living One, saying, "His dominion is an eternal dominion, / And His kingdom is from generation to generation; / And all the inhabitants of earth are considered as nothing, / But He does according to His will in the army of heaven / And among the inhabitants of the earth; / And there is no one who can resist His hand / Or say to Him, What are You doing?" (vv. 34b-35). Further, in verse 37 Nebuchadnezzar praised, exalted, and honored the King of the heavens, because His works are truth and His ways justice and because He is able to abase those who walk in pride.
As indicated by his praise at the end of chapter four, Nebuchadnezzar surely had learned the lesson to be abased and know God. In chapter three he set up a golden image because he was very proud. Chapter four follows to teach him a great lesson. Although he acted like a gentleman, he was a beast. After this chapter the record of Nebuchadnezzar comes to an end.