First off, the guy's name is Judas. Second, this is an example of Gibson using artistic license. Much of the movie is not necessarily found in the Bible or other sources, but as many directors do, they create scenes to emphasize some point. In this case, the hallucinations were meant to represent Judas' conscience eating away at him, which is indeed mentioned in the Bible.
As far as the historical accuracy of the entire movie goes, I cannot say. But this is not a good example of historical inaccuracy.