Will I get a more resilient Pokémon by training mostly Defense or HP?

Solution 1:

It depends on the Pokemon and the base stats of that Pokemon.

It's generally a good idea to focus defensive EVs in the stat that is worse for that particular Pokemon.

For example, Wailord has a base HP stat of 170, but only a base defense of 45. He's going to have a ton of HP no matter what his EVs look like, so the boost to defense will make him more of a wall. Conversely, Golem has a base defense of 130, but only 80 base HP. You're better off training his HP because his defense will make him more resilient.

They are both important. If you have an utter lack of either one, you're going to go down pretty easily. In general, Defense is probably more important than HP, so if they're about even and you have to make a judgment call, err on the side of stacking defensive EVs instead of HP EVs. Really, if you're going for a real wall, get both. EV train HP and Defense for best results.

There are very detailed strategies for every Pokemon on Smogon, so that's a good place to start to see how people generally EV train specific Pokemon. You don't have to go exactly the way these are set up, but they're tried and true builds and are definitely a good starting point for getting into competitive play.

Another thing to note is that it's generally very difficult to have a Pokemon who is both a physical and special wall. You're better off focusing in one or the other, and maybe putting a few points in the other defense depending on what specific role you're trying to fill. A lot of competitive builds are specifically set up to withstand Attack X from Pokemon Y who is built with Choice Item Z, and to know that you only need 168 Defense EVs instead of 172 is based off knowing the metagame more than knowing general strategy. If you don't want to get into this level of ridiculous detail, then a more generic way to get similar results is to have a dedicated physical wall and a dedicated special wall as two of the six Pokemon in your team.