A theory is presented that explains the evolution of the pinealocyte from the common ancestral photoreceptor of both the pinealocyte and retinal photoreceptor. Central to the hypothesis is the previously unrecognized conflict between the two chemistries that define these cells-melatonin synthesis and retinoid recycling. At the core of the conflict is the formation of adducts composed of two molecules of retinaldehyde and one molecule of serotonin, analogous to formation in the retina of the toxic bis-retinyl ethanolamine (A2E). The hypothesis argues that early in chordate evolution, at a point before the genes required for melatonin synthesis were acquired, retinaldehyde--which is essential for photon capture--was depleted by reacting with naturally occurring arylalkylamines (tyramine, serotonin, tryptamine, phenylethylamine) and xenobiotic arylalkylamines. This generated toxic bis-retinyl arylalkylamines (A2AAs). The acquisition of arylalkylamine N-acetyltransferase (AANAT) prevented this by N-acetylating the arylalkylamines. Hydroxyindole-O-methyltransferase enhanced detoxification in the primitive photoreceptor by increasing the lipid solubility of serotonin and bis-retinyl serotonin. After the serotonin --> melatonin pathway was established, the next step leading toward the pinealocyte was the evolution of a daily rhythm in melatonin and the capacity to recognize it as a signal of darkness. The shift in melatonin from metabolic garbage to information developed a pressure to improve the reliability of the melatonin signal, which in turn led to higher levels of serotonin in the photodetector. This generated the conflict between serotonin and retinaldehyde, which was resolved by the cellular segregation of the two chemistries. The result, in primates, is a pineal gland that does not detect light and a retinal photodetector that does not make melatonin. High levels of AANAT in the latter tissue might serve the same function AANAT had when first acquired- prevention of A2AA formation.