The technique is called counter‑singing or, in a structured musical context, counterpoint (where independent melodic lines interact harmonically).