Use this kind of sentence to talk about something that someone does which is strange and hard to understand or accept:
A: He told me that you were talking crap about me.
B: What? That's not true! Why would he say that?
You can also talk about yourself, if someone makes a suggestion that you think is ridiculous:
A: You should quit your job.
B: Why would I do that? I love my job!