Kukulkan's city was a riddle, given to Humanity by Kukulkan. When Kukulkan visited the ancient primitive civilizations of Earth many centuries ago, he gave them each the knowledge necessary to build the city. If built correctly according to the accurate cycles of the calendar Kukulkan had given them, the city would become a signaling device to call Kukulkan. His plan was for the Human civilizations to cooperate in peace. However, none of the civilizations built the city as Kukulkan had designed.
After a long time without receiving the signal, Kukulkan sent a probe to Earth to check in on Humanity and found that they had become warriors filled with hate. When the USS Enterprise followed the trail left by the probe, the crew found Kukulkan. Once transported aboard his ship, Kukulkan used his machinery to create a virtual manifestation of the city as Kukulkan had designed, and gave them another chance to solve the riddle. They discovered that the four serpent-head pillars on each corner of a giant pyramid had to be arranged a certain way relative to the sun to complete the energy amplification device that served as the transmitter. (TAS: "How Sharper Than a Serpent's Tooth")