I think upbringing helps to a degree but ultimately it is personal choice. The term good though is such a grey area. I think a good person considers the possible consequences of their decision and chooses the one which causes the least pain to others. So again ultimately by choice.