In general, if a culture settles in an inhospitable environment (assuming it has other choices), it is because that environment offers something that is not available in other places where that culture might choose to settle.

In the case of the Chavin, it is believed that they settled in the high mountains by choice and not because they were forced to live there. The most usual explanation for why they chose to settle there is that it was centrally located along trading routes. People traveling from the coast to the eastern slopes of the Andes would have needed to go through the Chavin territory. This would make their territory a good place to be, just as modern towns often grow up around highways and towns that are bypassed by highways shrink.