Nebuchadnezzar is arguably the most complicated character in the Book of Daniel. You would expect him to be a classic, stereotypical bad guy—an unrighteous king, like Pharaoh in Exodus, someone who runs afoul of God and then gets what's coming to him. At certain points, he does behave like a classic, arrogant bad boy who believes that he's at the center of the universe—for instance, when he flips out and orders all of his enchanters to be executed for not being able to interpret the dream he refuses to tell them about. And then there's the time when he up and throws Shadrach, Meshach, and Abednego into the fiery furnace.
Yet, the evil Nebuchadnezzar does isn't the product of his own actively evil intentions—it's something created by his ignorance. Nebuchadnezzar's confusion, his inability to see the truth and remember the truth, is what causes him to do bad things. It's not like he doesn't want to know the truth. He seeks out interpretations to dreams that disturb him, because those dreams seem to point towards some higher or greater truth about the way the world works. Ultimately, he wants to know the truth about God and about the meaning of life in the world, but his pride as a king makes it impossible for him to hold on to it.
Sure, Nebuchadnezzar is able to get glimpses of the truth. After Daniel interprets his statue dream for him, Nebby declares "Truly, your God is God of gods and Lord of kings and a revealer of mysteries, for you have been able to reveal this mystery!" (Dan 2:47). But this newfound realization evaporates in the next chapter, when he condemns Shadrach, Meshach, and Abednego to get burnt to a crisp for refusing to worship any god but God—the same God Nebuchadnezzar had just finished praising a little while ago.
So Nebuchadnezzar is unable to hold on to the realizations he's managed to have, so far. In order for him to be able to finally get the message and retain it within his extremely proud and sort of tormented cranium, he needs to undergo a big transformation. And transform he does. Word comes down from heaven that he's going to need to become like a wild beast and wander in the wilderness for seven years. At the height of his pride, he gets cut down to size—classic.
But why does Nebuchadnezzar need to become a beast—or at least some sort of weird guy with hair like eagle feathers and hands like talons—in order to become humble? Well, becoming humble implies humiliation, getting brought low at some point, forcing you to realize that your own fate is out of your hands.
So Nebuchadnezzar, being prouder than pretty much anybody, needs to go through a bigger and a rather far-out transformation. In the end he's like Job, who humbles himself before God while accepting the human condition and regaining all that he has lost. Nebuchadnezzar too regains his sanity when he blesses "The Most High." He says, "for all his works are truth, and his ways are justice; and he is able to bring low those who walk in pride" (Dan 4:37).
Nebuchadnezzar, in reality, was actually Nebuchadnezzar II. His name, incidentally, means that he is the eldest or first-born son of Nabu, the Babylonian god of wisdom and writing. Maybe this helped foster Nebby's appreciation for the wisdom that Daniel was able to lay on him?