You are right, of course. By rights, Albany would have the strongest claim to the crown by the end of the play. However, let us briefly consider the Duke of Albany and his role in the play. He is shown to be basically a good man. However, he allows himself to be dominated and manipulated by his evil wife, Goneril. Even when he becomes aware of his wife's more sinister actions and motivations in the second half of the play, he still does very little to actually stop her. As a result, he is showing the way in which even good characters in this play are shown to be rather weak and ineffectual.
Perhaps, then, his ceding of the kingdom in the final lines of the play to Edgar and Kent is an indication of his own inability to be the kind of ruler that Britain needs at this particular point. Note how he actually phrases this bestowing of power:
Friends of my soul, you twain
Rule in this realm, and the gored state sustain.
Albany perhaps is able to see with clarity that Britain, in its current "gored" condition, needs a strong ruler that can give it direction, strength, and stability. He has been able to reflect on the fact that the way his wife dominated him indicates that he is not that kind of ruler. His goodness is therefore shown through the way that he puts the needs of the nation over his own personal ambition and chooses two characters who he thinks will do a better job than he will.