The differences in the birds' beaks are due to evolution and natural selection. One island may have an abundance of seeds and nuts which require a large beak to crack them open, meaning that birds with a phenotype for larger beaks had an advantageous allele that allowed them to outcompete other birds with smaller beaks and to reproduce, passing their allele on tottheir offspring. Over time the unfavourable allele is selected against and disappears from the population.
The other island may have more small insects, requiring long thin beaks to reach them, and so birds with larger beaks were selected against and those with the advantageous small beak allele survived to pass on their phenotypes to their offspring.