He did it because it was against the rules. He became disqualified on purpose.
Killua has been influenced by his family since the moment he was born, being taught to believe that he could do nothing other than kill. If Illumi told him he wasn't worthy of a friend and shouldn't be a hunter just yet, Killua would purposely fail the exam.
Illumi had basically told him he would end up wanting to kill Gon if he stayed with him.
In the movie, Phantom Rogue, Killua can't even move when faced with the prospect of fighting even a doll of his brother. It just shows how much influence Illumi has over Killua.
It's been shown multiple times that during the earlier years of hxh, Killua had little to no hesitation about killing and, although it's said he's sick of killing, I think he stopped killing later on more because Gon said so, rather than he thought it was morally wrong. Therefore, exiting the final exam in such a dramatic way is not so shocking by his standards.
Killua's got a huge amount of bloodlust underneath the exterior, as it becomes apparent when he goes into 'assassination mode'. Killing would be a way of venting anger and frustration.
I guess a part of Killua would want to cut off all chances of becoming a hunter as soon as possible because that is what his brother would have wanted. If he continued to fight in the tournament, a person might randomly forfeit to let him win. Unlikely, but still possible.
And finally, a tinsy, winsy part of him might have wanted to help Leorio.