It usually comes down to one of three things: content, audience, or language.
Content. Sometimes a specific element is judged unsuitable elsewhere. Harvest Moon DS Cute was eventually released in the United States in limited quantities after concerns about the female character being able to marry another woman — the game shipped, but in small numbers.
Audience. More often, publishers simply decide a title will not sell. Niche Japanese games carry a real localisation cost, and if the expected return does not cover it, the game stays home. Occasionally there is a grudge involved too, as with the early Metal Gear releases.
Language. Some games cannot travel without being rebuilt. Taiko Drum Master, a rhythm game in the mould of Guitar Hero, stayed in parts of Asia because its song list is entirely Japanese. A PS2 version did reach the US years ago, but every track was swapped for American pop songs — which tells you how much work localisation can involve.