The answer to this question is 'convergent evolution'. Basically, this is when species of different lineages independently evolve similar functional features.
Development of wings is a classic example as this has independently evolved in insects, birds, pterosaurs, and bats.