In this case, “would“ is used to express the feeling of wonder.
For instance, you know that someone wants to kill Jerry, but at the same time you have no idea for what, because he is a really nice guy and you have known him for ages. In this situation you might say: “why would anyone want to kill Jerry?“.
Also, you know that everytime when he is going somewhere, he puts his keys on the table, so when you come home, you find them. But this time when you came home, you couldnt find the keys. In this case, you might wonder: “why would he leave the keys hidden?"
I hope it helped.