Because organisms that evolved to avoid that thing we call pain survived long enough to pass on their genes, whereas those that didn't got burned up, crushed or in other ways extinguished?
In other words an aversion to that thing called pain gave an evolutionary leg up. And it seems that this aversion is fundamental to life since every creature has a tendency toward self preservation.
There are many examples of people who enjoy physical pain and perform cutting even down to bone, and sometimes including amputation. Clearly this is an example of brain wiring which is not beneficial to the individual and, in extreme cases will self-filter out of the gene pool.