It is a simple idiom, which means : hey, are you crazy ? or hey, what's wrong with you ?
Let you are having a breakfast with your friend and after sometime, your friend starts behaving like a stranger, you would say "hey, are you crazy ?" or "what's the deal ?".
I think it'd help.