Perhaps not exactly "junk dna" but you are right in your thinking about gene duplications... duplications are thought to promote "neofunctionalization" (a new function) or "subfunctionalization" (specialization).
See wikipedia [1] for an overview.
[1] https://en.wikipedia.org/wiki/Gene_duplication#As_an_evoluti...