what on earth is wrong with you?

What on earth is wrong with you is an expression that is used in the literal sense where you are asking what is wrong with someone. The phrase is speaking about someone doing or saying something so startling and that someone most likely does not agree with, and using the word Earth because they cant imagine anyone on the planet would ever think to do or say this intentionally.