When you get right down to it, most of us are really quite selfish.
Indeed, we try to avoid admitting this to ourselves or others, because of the embarrassment it causes us. On some level, this denial is admirable, but on another, it is quite overdone – being selfish is part of the human condition. After all, selfishness is an outgrowth of what the rabbis called the yetzer hara, the drive to pursue pleasure. As such, the rabbis understood selfishness to be part of our natural makeup. As is true of our physical bodies, even if our ultimate goal is to transcend our selfish inclination (see Ideas 34), in the meantime, it appears that it is designed to help us.
Both selfishness and the body are things that separate us from others and seem to be impediments to the central and topical mitzvah of Ahavat Yisrael. This, however, is only half true, because it focuses on half of the commandment of Ahavat Yisrael and not the whole thing. The Torah commands us to love our neighbor/friend as we love ourselves. We focus on the commandment of loving our neighbor and forget the premise of "as we love ourselves." To put it a different way, if we are expected not to be selfish i.e. not to love ourselves, than the Torah is commanding very little when it tells us to love someone else like we loveourselves. Better to leave it simply as "love your neighbor," since adding the phrase "like yourself" would simply detract from this obligation.
In fact, the love, commanded by the mitzvah of loving neighbor as self, is an intense and demanding love and so, must be learned in a personal and emotional fashion. (This, in contrast to the intellectually attainable love of the stranger, where the Torah simply states to love the stranger, giving us the rational explanation that we were also once strangers.) The intensity and complete dedication to oneself that we see most clearly in small children is to be the paradigm for our love of others. And actually experiencing this self-love is the only way to internalize how we are to love our fellow Jew.
It follows, then, that we really are expected to love ourselves, and that this is an unavoidable situation on the way to the transcendence envisioned by the mitzvah of loving others. That being the case, it is difficult not to be struck by the Divine wisdom in giving man the ability to love others by implanting within him a most natural tendency to love himself.
The rabbis aptly compare our selfish nature (yetzer hara) to fire. Fire is one of the most useful and important tools known to man; it is also one of the most destructive. By the same token, the rabbis tell us that we are expected to use our yetzer hara in our service of G-d (Berachot 54b - see also Etz Yosef). It is highly useful in helping us internalize how single-minded and intense our service to G-d is meant to be. Yet, that same single-mindedness with which we love ourselves makes it difficult to contain and, when not contained, dangerous indeed.*
It is perhaps, because of the danger associated with the yetzer hara that the rabbis (Yoma 69b) asked G-d to remove this drive from man altogether. The Talmud reports that when G-d agreed to this request, the world basically ceased to function. In this way, G-d was showing that without the drive to advance self, we would also not properly pursue any goal.
I am neither suggesting that we glorify selfishness, nor that we defend it where it is inappropriate. As mentioned above, without limits it can wreak havoc. Nonetheless, we need to understand and accept ourselves more.
Most of us will need to wait until we reach the next world to attain the very sublime level of complete transcendence, whereby one actually feels no difference between self and others. In the meantime, it is counterproductive to pretend that such is the case. It would be the same as pretending we have no body, and so not eat or sleep. Just as G-d wants us to take good care of, and nourish, our bodies, the same appears true of our egos. The ultimate goal may well be to shed both our bodies and our egos, but as long as they are a part of us, we need to take good care of them.
Halacha provides the guidelines as to when we can act upon our selfishness and when we cannot. As with precautions taken in the use of fire, these guidelines are often quite rigid and demanding. But even when we cannot indulge our selfish wants, recognizing (though not wallowing in) the intensity of these desires can continuously serve us as a reminder of the intensity that we need for everything that is worthwhile doing.
* This may also be seen in the Ashkenazi formulation of the final beracha of the birchot hashachar which requests "Veal yishlot bee yetzer hara," that I should not be controlled by my yetzer hara, the implication being that it only creates a problem when it is out of my control. The Sepharadi formulation, however, of "Tarchikeni me’yetzer hara," meaning keep me far from the yetzer hara, remains more difficult to explain.