Without any context, it's only possible to guess.
"What are/were you thinking?" often means "How do you justify what you are doing? This seems to be unusual behaviour. What is motivating it?"
If you have a question about the English language and would like to ask one of our many English teachers and language experts, please click the button below to let us know: