This is a question that I've struggled with a lot. And my only real insight I could get was that there is a problem with how this question is assumed.
Firstly most people discuss selfishness with a focus on how it is a bad thing with damaging outcomes, but I would argue that there is a sidestep to this which is: What type of selfishness are we talking about? I think there is a mutual selfishness that is beneficial, where all parties involved get something and this about as close to altruism as we can get.
On the other hand, I've had some experiences that definitely changed how I look at this question, and I was a deeply cynical person for a long time in my own life.
I used to work at a retail store on a council estate near where I live. Outside we had emergency defibrillators mounted on the wall with an access code (which we had to scratch off the front and keep inside the store because local kids kept messing with it and taking it out).
On this occasion, a young man came running down and demanded, aggressively, that we get the defib out for him because he said his mum was dying. I could see he was on the verge of tears and pretty distraught, so I got the code, got the defib and asked him if he wanted me to come with him, to which he said yes. We both ran up to the top of this estate (it's on a big hill so it's very sharply inclined) and to his house where a neighbour was already doing chest compressions.
Now a defibrillator only shocks the heart into its proper rhythm, either shocking it from arrhythmia or starting it if it has suddenly stopped. In this situation, the man's mother was cold to the touch and turning blue from the lack of oxygen in her blood. The neighbour actually gave me a very small shake of the head, indicating no hope I think. Even so, I cut her cardigan off and placed the defibs where it said to.
And the automatic voice on the box said to just do compressions. So that's what myself and the neighbour did for the next 7 minutes before the paramedics arrived.
Now the point of this story is that when he said he needed it and that he wanted me to come with him, at that moment I wasn't worried about whether or not I would look good, or if I could be bothered/care. The only immediate thought was of my own parents and other people that I love. And I realised I would, most likely, want someone to come with me too.
And you can easily argue the selfishness of this, it's only through my own family and relations that I cared, abstractly, about his mum. It could also be argued that I unconsciously wanted to look good (and that can go for here on a forum too by mentioning it).
And lots of other angles as well. However, going back to that sidestep, my main point is: Does that matter?
Does it matter if I was selfish or not? Wasn't the outcome the same as if I were selfless?
Is it not more important to distinguish between the more conscious drives and the unconscious ones? There's a world of difference between a psychopathic go-getter who sabotages everyone else in a zero-sum game of "what can I get?" and someone who simply acts based on an instinct that could be called selfish but is about as removed from the former as possible.
I don't think of myself as a good or bad person in that situation, just someone who acted.
As an aside, when it comes to the causal web of behaviour, that is a different issue and one we don't actually have a way out of.
Only the old quote: “We must believe in free will, we have no choice,” Isaac Bashevis Singer