Resemblance between unrelated model and mimic is an example of convergent evolution produced by selective advantage, not shared ancestry or gene flow. Individuals in the mimic population that more closely match a signal already avoided by predators survive and reproduce at higher rates. Across generations, selection increases alleles affecting color, shape, movement, odor, or other relevant traits, even though the model belongs to a separate lineage. Habitat sharing can create the ecological opportunity because both organisms encounter the same receivers, but proximity alone does not generate
Ref:
Evolutionary Analysis, Herron & Freeman, 5th Ed., Ch. 10