In the movie, the Witch King breaks Gandalf's staff. How did this happen and why (since it's not in the book)?
While Gandalf faces the Witch King in Minas Tirith, there is no record of Gandalf's staff being broken. The flaming sword is seen in the scene in the book, from Return of the King, The Seige of Gondor:
After that scene, Rohan arrives, and the Witch King flies off to handle them.
The Witch King's ability to destroy other's weapons is found in the books, however. From The Fellowship of the Ring, Flight to the Ford:
From the same chapter, after the wraiths are driven off, Aragorn is examining the cloak left by the Witch King:
It's likely that Jackson interpreted Gandalf's raised staff as a "blade to pierce" the Witch King. It doesn't say in the books whether the WK could destroy an Istari's staff, but I think that scene is Jackson's interpretation of these scenes in the book.
AFAIK, there was no Jackson commentary on that specific scene, so one can only speculate.
As for "Why", the most cogent speculation I have seen on the forums is that the scene served to:
A second theory was that this was to highlight the power and contribution of the World of Men - Gandalf is almost beaten and can be killed by such a powerful adversary, yet saved by the fact that WK needs to go away and deal with Rohirrim - which, if you know the backstory of Istari, actually jibes with Tolkien's overall vision of the order of things (Olorin's mission is to inspire Middle Earthers to fight Sauron, not to fight him himself with his Mayar powers).
This has further symbolic significance in that this mirrors Gandalf the White's breaking of Saruman's staff.
As for "How", there just isn't any info. WK holds a flaming sword, stares at Gandalf, and the staff explodes.
The short answer is, Peter Jackson thought it would be cool.
Gandalf is far more powerful than the Witch king for a number of reasons.
As cool as the scene may look, it has no basis in the world of the books. If the Witch King was able to overpower Gandalf as easily as he did, there is literally no way that Eowyn and Merry would be able to touch him, let alone kill him.
I think it is important to keep in mind that Gandalf the Grey did not operate in a mode of "If it kills me, I will come back." His sacrifice at Khazad-Dum was absolutely done at risk and his arrival in Fangorn was very much a shock to everyone, himself included. You see in his manner of speech, not "I came back, I can do that you know." but "I have been sent back" and "I am Saruman as he was meant to be." It clearly came across to me that he was baffled by the turn of events but pleased with the second chance.
I don't have a reference handy but I was told by a Scholar of Arda much greater than me that once the Nine had been fully subsumed by the power of Sauron that he took their rings back. This is why when he falls they dont have a ring of power in the pile of Nazgul detritus.
Back to the original topic, there is no literary reason in the narrative for the Witch-King to shatter Gandalf's staff. It is in the movie for two intertwined reasons:
1 Dramatic Effect
2 Peter Jackson likes to repeat himself (the Breaking of Saruman is cool, lets use that again. see also Hobbit2-Kili-Tauriel-OrcPoison vs. Fellowship-Arwen*notGlorfindel*-Frodo-MorgulBlade)
In response to the 9 Feb at 0:45 answer.
It's stated in the book that Gandalf is a Maiar (Olórin), therefore he cannot be fully destroyed, only his physical form, just like Sauron's was. So, even though the Witch King had more power at that specific scene, he could not vanquish Gandalf, who would come back once more, and maybe even more powerful, as he did before.
I think the reason the staff breaks is because,
A. Sauron has infused a good amount of his power into the ring that the witch king bears, and since Sauron is much much much more powerful than Gandalf, he could have given the Witch King enough power to be more powerful than a normal Miar.
B. Staff is only a part of Gandalf's power, and Gandalf is not allowed to use his full power while on Middle Earth, only a small fraction of it. If he could use his full power, he could have destroyed Smaug, instead of getting a bunch of Dwarves to do it. The Balrog that Gandalf killed was probably much weaker than a Sauron aided/power-induced Witch King.
Therefore, for these reasons, mainly because the Witch King was heavily power fuelled by Sauron, it is very likely that the Witch King can hurt Gandalf. But who becomes the victor in a one-on-one battle remainsto be seen.