I think it's not so much wrong as it is ambiguous.
"What is the matter?" is an idiomatic phrase meaning "what is wrong?"
Matter, by itself, can refer to physical material ( dark matter in the universe), an issue ( a legal matter, a situation).
The first sentence is ambiguous. It could be asking what was the matter (physical material) e.g sitting on the table.
The second sentence uses the idiomatic phrase, so the question is asking if you knew what was wrong.
I think most native English speakers would understand the question being asked was "what was wrong?" Whichever way it was asked.