King Nebuchadnezzar's story is told in the book of Daniel. He is a dreamer, whose dreams are interpreted by the prophet, who's also called 'Belteshazzar'. The dream of the image with a gold head and feet of clay is well known (chapter 2). But he also dreams of a tree that is cut down, with only the stump remaining. Daniel interprets the dream to mean that the tree stands for Nebuchadnezzar himself. He will be 'cut down' and sent to live with the animals until 'seven times' pass by for him (4:16) unless he repents of his sin.
A year later Nebuchadnezzar is walking on the roof of his palace in Babylon and says in his pride, "Is not this the great Babylon I have built as the royal residence, by my mighty power and for the glory of my majesty?" (30).
Immediately, "what had been said about Nebuchadnezzar was fulfilled. He was driven away from people and ate grass like the ox. His body was drenched with the dew of heaven until his hair grew like the feathers of an eagle and his nails like the claws of a bird" (33).
It looks as though Nebuchadnezzar was suffering from a form of mental illness called "boanthropy", where someone is convinced they are an ox or other bovine.
Some scholars have suggested the story in Daniel was based on a story about another king of Babylon, Nabonidus. A fragmentary 'prayer' left by him refers to him being "afflicted for seven years" and being driven far from men until he "prayed to the most high God". He says a Jewish exorcist pardoned his sins.
Another fragment refers to Nebuchadnezzar's eldest son Evil-Merodach and may indicate that Evil-Merodach took over as regent for his father during a period of illness. Text is missing, but it says "his life appeared of no value to him...then he gives an entirely different order...he does not show love to son or daughter..."
Whatever the origins of the story, the book of Daniel was written to show us what happens when we turn away from God. Our highest calling is to serve him. When we go our own way and fail to acknowledge him, we descend to the level of animals. We may not look like Nebuchadnezzar, with his hair as long as eagles' feathers, but in our moral and spiritual nature we've become like him. God asks for our repentance and faith to bring us back to what we ought to be.