Though the question is adequately answered by the doctrine of OS for those within the Church, there is yet the vast majority of non-Catholics for whom this is not a sufficient answer. May I suggest that yet within Church teaching there might be a more fundamental explanation that works over a broader spectrum?
I like what fhensen said about it, that we naturaly do what we think is good. I agree with that. Consider, for instance, that serial killers score exceptionally high on tests for self esteem. They have no doubt that they are doing what is good for themselves. So I would suggest that we could look at our idea of ourselves and its relationship to our idea of good.
All bioligical systems display irritation (the response to stimuli) and act to preserve homeostasis (the condition of biological balance) In humans, and to some extent in other animals, themental realm enters into this sense of homeostasis. And chief in the factors of homeostasis in the mental realm is the sense of self. We could say in this regard that there is a continuum of self sense from completely immature and ego centered to mature and We centered, a condition in whichthe individual percieves themselves to be an integral part of a group. IN the extreme of this last, the individual seeks to be and feels at one with God.
So the specturm of maturity goes from separation and isolation (hell) to inclusion and Unity (heaven) The more mature one is, the closer they are to the feeling of Unity. The less mature, the cloer to isolaton and separation. This, IMHO, is why that we see tow major ideas in religion and philosophy as avenues of accomplishment. The first of these is the two forms of the golden rule. The second is “know thyself.”
So as far as I can see a broad spectrum definition of sin is immaturity of sense of identity. Someone who completly and utterly feels the other as themselves is incapbale of sinning against someone else, and thus is “above the law.” Such a person can’t hurt what he sees as himself. On the other hand, the imature person sees differetiaton between tehmselves and others, and thus objctifies others and things, and the relationships that come with those. It is mine vs theirs, me vs them, etc etc etc through all the polarities of ego. With that come judgement and resentment, etc. and therefore need.
All the while, one’s self is felt to be the ultimate good, that feeling that “I am, therefore I’m good.” So it is not percieved as wrong to the immature person to do thinkgs that are self satisfying in contradiction to a greater moral code, artificial or not. So I guess I am saying that we sin, or not to satisfy our sense of self. It just depends on who or what we feel our sense of self to be; somewhere between unloved, isolated, alone, unsatisfied, and Loved, included, Unified, Satisfied.
“Love thy neighbor as thyself.” Why? Ulitmately because thy neigbor is of the same stuff you are and I am. Goodness is the recognition of that and acting on it.