This is precisely what has not yet been explained. When people question the popular explanations of the origin of complex adaptations such as the vertebrate limb, or sexual reproduction, or the tongue of the woodpecker, or the reptilian hard-shelled egg, they are usually given a litany of reasons why these structures are beneficial to the organisms. More precisely, the selective advantage of these structures is offered as the reason they evolved. But this begs the question again. It is not sufficient for an evolutionist to explain the function of a particular structure.
Natural selection does explain how organisms adapt to minor changes in their environment.
Natural selection allows organisms to do what God commanded them to do. That is to be fruitful and multiply. Natural selection does not, however, explain the crucial question of how complex adaptations arose in the first place. We have been led to believe that it is not to difficult to conceive of a mechanism whereby organic molecules can be manufactured in a primitive earth and organize themselves into a living, replicating cell. Nothing could be further from the truth.