"Why?" in English can have (at least) two distinct meanings.
1: What is the cause of this?
2: What is the purpose of this?
For example, if your child asks you "mom/dad, why do we have a heart?" and you reply with "We have a heart because it pumps blood into our body and brain and lets up stay alive" or something like that, you have interpreted that "why?" in the second meaning, "what is the purpose of this?". (The necessity of) pumping blood into a body and brain to keep that being alive is not the cause of the existence of hearts, but rather, its purpose. The same reasoning applies to the question "why did you do this?". The usual answer is an explanation of the purpose of that action, rather than saying something like "because some electrical signals fired in my brain and led my body to perform certain movements", which would be the answer of "why did you do this?" in the first sense.