There are several was to explain the betrayal of Jesus in biblical context. 

A frequently mentioned idea is that it was predestined by God. Jesus was sent to die for our sins and so whatever Judas' personal motivation was, he was helping Jesus to fulfill his destiny. He may even have known this, despite his feeling of guilt afterward. This is supported by Jesus' words at the Last Supper: 
“Do quickly what you are going to do.” - John 13:27

Against this we have the curse of Jesus in Matthew 26:24 "Woe to that one by whom the Son of Man is betrayed! It would have been better for that one not to have been born.” But this is prefaced by "The Son of Man goes as it is written of him." So the idea that it was predestined leaves us with questions about why God would use Judas to fulfill his will, but also condemn him for fulfilling his divinely appointed role.

If we want to go beyond the theory that Judas was God's agent to fulfill Jesus' destiny, we have to speculate about Judas' motivation, a motivation strong enough to cause him to use his free will to betray Jesus even though  Judas had witnessed God's power in Jesus so dramatically. 

One theory is that Judas was a Zealot, a strong Jewish patriot who wanted to prod Jesus into action against Rome. For Jews, the Messiah did not come to die for our sins but to re-establish the Davidic throne, and to do so the Messiah needed to take dramatic political action. Judas' possible identification as a Zealot is indicated by two bits of evidence: his name "Iscariot" may be related to the word for the faction of Zealots know as the 'sicarii,' meaning dagger-men. Also, in the [*Epistula Apostolorum*](https://www.earlychristianwritings.com/text/apostolorum.html) verse 2, [2nd century] Judas is called Judas Zelotes, an appellation usually associated with another apostle, Simon the Zealot. In this view, Judas believed Jesus was indeed the Jewish Messiah who had divine power, and by turning Jesus over to the Romans, Judas thought he would move Jesus to dramatic action. 

The Gospel of John suggests another possible motivation for Judas: financial corruption. John 12:3-6 states:

> <sup>3</sup> Mary [of Bethany] took a pound of costly perfume made of pure nard, anointed Jesus’s feet, and wiped them with her hair... [But Judas] said, <sup>5</sup> “Why was this perfume not sold for three hundred denarii and the money given to the poor?” <sup>6</sup> (He said this not because he cared about the poor but because he was a thief; he kept the common purse and used to steal what was put into it.) 

The narrator makes Judas' motivation clear: he was a thief, and thus greed may also be attributed to his selling Jesus out for 30 pieces of silver. Conversely, one might speculate that Judas felt Jesus was acting hypocritically and was himself guilty of financial corruption. Jesus  had taught that to enter eternal life, a rich man had to sell all he had and give it to the poor. [Mark 10:21] But here, Judas complains that Jesus was squandering a year's wages worth of pure nard on himself. Thus, Judas might have lost faith in Jesus, so much so that he was willing to betray him as a false messiah.

The action of Mary of Bethany in this scene is also suggestive. To care for a man's feet was an extremely intimate gesture, and the use of a woman's hair to do so was scandalous. In addition to possible moral outrage, Judas may have also felt jealousy toward Jesus if he himself had a romantic or sexual interest in Mary. 

Finally, we should mention the 2nd century gnostic-christian [Gospel of Judas](https://www.gospels.net/judas), in which Judas is described as a co-conspirator of Jesus. This work, however, is considered heretical. Judas, like Jesus himself, is a pre-existent semi-divine being who comes to earth to show humans the Truth, which is that our physical bodies are only illusions from which we need to escape. 

> Jesus said to Judas "You'll do more than all of them, because you'll sacrifice the human who bears me. Your horn has already been raised, your anger has been kindled, your star has ascended..." verse 56

**My answer in summary**: there are several ways that Christians might explain why Judas betrayed Jesus despite witnessing God's power in him. They include that he was God's agent in doing so, that he was a Zealot who wanted Jesus to use God's miraculous power against Rome, that he was greedy and wanted money, that he lost faith because he thought Jesus himself was misusing money, that he was outraged or jealous over Mary of Bethany's intimacy with Jesus, or even that he and Jesus were both divine messengers and not normal human beings. These explanations are not mutually exclusive.