Ruk was an android found by Dr. Roger Korby in the underground ruins of Exo III. Ruk was built centuries earlier by the Old Ones; when Korby found him in 2261, he was still tending the machinery they had left behind. Even he did not remember how many centuries he had been doing this work.
In 2266, Captain James T. Kirk and Christine Chapel arrived at Exo III in search of Korby. By then, Korby had reprogrammed Ruk to serve him, and had devised a scheme to infiltrate android duplicates into society slowly and carefully. As part of that scheme, Korby and Ruk imprisoned Kirk and Chapel, and built a duplicate of Kirk to take control of the Enterprise.
Questioned about his origins by Kirk, Ruk remembered that the androids, presumably including himself, had become frustrated by the illogic and inferiority of the Old Ones. In turn, the Old Ones became frightened of their creations, and began turning them off. Their survival at stake, the androids overcame their programming and slew their makers. Once Ruk remembered this, he overcame Korby's programming the same way. No longer able to control Ruk, Korby destroyed him.
Ruk was tall, broad and immensely strong, capable of lifting a Human male easily with one hand. Despite his size, he could move silently and gracefully, making him an extremely dangerous physical opponent. He could duplicate voices effortlessly – his actual voice was very low-pitched and gravelly. He knew how to maintain and operate the machinery left behind by the Old Ones. (TOS: "What Are Little Girls Made Of?")
"More complex than Brown. Much... superior."
"THAT was the equation. EXISTENCE!... SURVIVAL... must cancel out programming!"