Actually, in the case of mutations, the code was not already there in the bird. That’s what a mutation is, a change in the DNA from what was there to something different.The code was already there inside of the bird.
That change is usually an accident. These accidents in replication happen all the time. They go unnoticed unless they happen to damage the way something works and cause a noticeable difference. Then we see a new form occur that had never occurred before. Due to an actual change in the DNA.