There is a subtle difference between these two sentences. They can often be interchanged because they both convey this message of person B not understanding why person A quit. But here's what makes them different:
1) Why did you do that? – is a simple way of asking what the reasons for doing that are, there's this fact of person A quitting his job and we want to know what made him do this.
2) Why would you do that?– reveals that person B contemplates about a more general and even hypothetical situation, thinking of all possible reasons that could make person A quit. It also implies that person B is surprised, because maybe they thought that person A had a very good job and was satisfied with it.
So in terms of the answer you would get when you ask any of these questions they basically are interchangeable, but taking into account B's attitude towards this, their feelings, 1) and 2) convey slightly different messages. Maybe I couldn't make myself clear enough but I hope this helps!
Thank you very much. I can understand your explanation. 'Why did you do that?' asks only about the reason. A doesn't have any special feelings about this. Meanwhile, 'Why would you do that?' is like 'Why did you do such a thing?'
Well, seems like you understood the concept, but your example is somewhere 'in the middle' between 1) and 2) in terms of semantics. 'why did you do such a thing?' is nearly the same as 'why did you do that' (only showing more surprise). What makes sentence 2) different from sentence 1) is this 'would' that connotes some sort of hypotheticality and surprise.
To entangledbank: Oh this is a new case. Yes, I can understand this idea. Thank you.
To iMak7: Okay, so I just need to use the word 'would' when I want to connote some sort of hypotheticality and surprise.
Thank you for your time.