Quick answer
Что случи́лось?
shto sluchílas — always neuter -лось, whoever it happened to
The options
Why случи́лось
The subject is что, which counts as neuter, so the past tense is случи́лось — never случи́лся. The same goes for что бы́ло and что произошло́.
Softer versions
Asking straight out can feel blunt if you do not know the person well. Всё в поря́дке? and Что-то не так? give them the option of a short answer. У тебя́ всё хорошо́? is the gentlest of all.
What you hear back
Typical mistakes
Что случи́лся?
Что случи́лось?
что takes neuter agreement.
Что ты случи́лся?
Что с тобо́й?
“What’s wrong with you” uses с + instrumental.
Check yourself
Which is correct?