It is a miracle of nature that a set of genetic codes have assembled tens of millions of different species on the earth. However, no one knows exactly how these genetic codes came into being. Many biologists hold the pessimistic view that an exact reconstruction of the process of code construction may never be possible. It is even believed that the origin of the genetic code is unknowable, as there is no trace in physics or chemistry of the control of chemical reactions by a sequence of any sort or of a code between sequences. Many papers have been published with titles indicating that they explore the origin of the genetic code, but in actuality the content deals only with its evolution. More than half a century has passed since the discovery of genetic codes, but their origin is still one of the greatest mysteries in the modern life sciences. Are the genetic codons really unknowable? Do they require external design? So far, several hypotheses have been proposed to explain the origin of the genetic code, including the frozen accident hypothesis, stereochemical hypothesis, co-evolution hypothesis, and synthetic hypothesis. These hypotheses suffer from two fatal defects: first, none can explain satisfactorily why the genetic codes evolved, and second, none has explained the origin of genetic codes from that of the biochemical system (a relation of part to whole). In other words, all of these hypotheses completely overlooked the coevolution of genetic codes with the biochemical system. In recent decades, very little definitive progress has been made, although intensive studies have focused on variation or flexibility of the codes and possible rules of codon allocations to amino acids. This paper is aimed to explore the secrets of coevolution between the codon and the biochemical system. The genetic codes were likely an evolutionary product of primordial cells from energy transformation to informatization when ATP played a crucial role. Here, we present an ATP-centric hypothesis aimed at exploring the hidden primordial world inspiring the origin of genetic codes. We examined how and why ATP is at the heart of the extant biochemical system, and how the genetic codes came into being with the evolution of the biochemical system driven by photosynthesis. ATP, carriers of both energy and information, provide a bridge between amino acids and proteins, and are most likely the initiator of the genetic codes. In short, the energetic ATP together with its derivatives could randomly extend chains of both polynucleotides and polypeptides, which made it possible to establish or fix chemical relations between sequences of nucleotides in polynucleotides and amino acids in polypeptides from their numerous random combinations through a feedback mechanism (selection of cellular survival); and technically, photosynthesis, a goal-oriented process, enabled various biotic factors or reactions (ATP, lipid vesicle, informatization, structuralization, homogenous individual, individuality, survival, etc.) to be integrated into an operating system of genetic codes. It is challenging to crack the mystery of genetic codes, but sophisticated experimental evidence are needed in the future.