When you would use which really depends on the random variable you're interested in. If you're interested in the number of trials needed to obtain the first success, use the first kind of geometric distribution. If you're interested in the number of successes you are able to achieve before the first failure occurs then use the second kind of geometric distribution. (Inverting the interpretation of the second version like this also requires you to redefine the success probability as $1-p$ and the failure probability as $p$.)
As the Wikipedia page says, "Which of these one calls 'the' geometric distribution is a matter of convention and convenience."
I find the two different versions confusing myself. When I read somewhere that $X$ has a "geometric distribution," the writer isn't always careful to specify which one is meant, and then I have to spend time figuring out which one it is. This confusion also spreads to the negative binomial distribution, which is a generalization of the geometric distribution. The exponential distribution, which is a continuous version of the geometric distribution, and the gamma distribution (a generalization of the exponential), have more than one definition, too. It's too bad that these weren't standardized with one definition for each, but part of the reason they weren't is that the different versions are useful in different scenarios.
In response to Josh Guffin's comment: Yes, in many contexts it is easy to figure out which geometric distribution a writer is referring to. However, in some it is not. Wikipedia's page on moment-generating functions is a classic example. The table there gives the mgf's for the negative binomial (and thus geometric), exponential, and gamma distributions, but it doesn't specify which convention for each one is being used.