Quoted By:
Well this was a plot point in Gen V, though it's explained in the Sinnoh myths and (I think) Masuda said something similar at one point, that they appear before trainers intentionally as a sort of test/befriending ritual. Meaning they do want to be caught and travel with trainers, another thing to note is that many Pokemon are still pretty feral, but do have the capability to become fully sapient after being caught and trained. Catching Pokemon is more or less a form of self defense and really Pokemon can probably escape/retaliate against their trainers anyway.