There are a number of hypotheses as to how the genetic code originated. One is the frozen accident model in which the code used in modern cells is the result of an accident, a bottleneck event. Early in the evolution of life on Earth, there may have been multiple types of organisms, each using a different genetic code. The common genetic code found in all existing organisms reflects the fact that only one of these organisms gave rise to all modern organisms. Alternatively, the code could reflect specific interactions between RNAs and amino acids that played a role in the initial establishment of the code. It is not clear which model reflects what actually happened. What is clear is that the code is not necessarily fixed, there are examples in which certain codons are “repurposed” in various organisms. What these variations in the genetic code illustrate is that evolutionary mechanisms can change the genetic code234. Since the genetic code does not appear to be predetermined, the general conservation of the genetic code among organisms is seen as strong evidence that all organisms (even the ones with minor variations in their genetic codes) are derived from a single common ancestor. It appears that the genetic code is a homologous trait between organisms.
234 The genetic code is nearly optimal for allowing additional information within protein-coding sequences: http://234genome.cshlp.org/content/17/4/405 and Stops making sense: translational trade-offs and stop codon reassignment: http://www.ncbi.nlm.nih.gov/pubmed/21801361