Reason #1: future favors, tit-for-tat types of responses. If I help a friend out in a time of need, some day when I am in need the same friend might be able to help me. Neither of us are related, but we've both increased our survivability. This effect becomes more prominent with communities, even communities of unrelated individuals: you all survive or die as a group.
Reason #2: a fluke of the system. Evolution doesn't provide perfect solutions, just "good enough" solutions (evolution is dumb). Thus a species that is very good at being altruistic for close relatives (a beneficial thing), but occasionally is altruistic for unrelated strangers (possibly not beneficial) might be, on the whole, better than one that is never altruistic.