The word “wrong” is wrong. It pre-judges the person before knowing what happened.
What happened to you? if communicated in a caring tone, opens up a conversation for the person to explore how the incident impact his/her responses/actions.
What’s wrong with you? may evoke a defense against the judgment, or swing into a self-abasement.