Vaal was created by a small faction of settlers of the planet Arret after the devastation of that world. These survivors decided that they would not repeat the mistake that they did with their homeworld by removing the potential of destruction from their race in order to spare their newly adopted home the same fate as their original homeworld.
To accomplish this, the people of Arret formed a synthetic living planet which would become Gamma Trianguli VI with the Vaal supercomputer being installed to serve as custodian of the world. Vaal was a necessary component in keeping Gamma Trianguli VI stable and without its guidance, the planet would self destruct.
Once Vaal came online, it blanked the minds of the settlers that it was charged to care for in order to prevent them from advancing to a state where they could produce weapons that would destroy the planet like it was done with Arret. Vaal would use the accumulated knowledge of its creators to watch over them and ensure that they were well cared for. (TOS comic: "Devil Down Below!")
In 2267, Vaal was challenged by the crew of the USS Enterprise under the command of Captain James T. Kirk. The encounter would result in Vaal being deactivated allowing the inhabitants of the planet to govern themselves. (TOS episode: "The Apple")
On stardate 8960.2, Spock would be captured on Gamma Trianguli VI by the Vaalite Akuta who wired him into Vaal. Once hooked into the machine, Spock learnt the truth about Vaal and its creators as well as the vital role it had to the inhabitants of the planet. It would be re-energized through the aid of Spock and the sacrifice made by Akuta which restored the balance to the world before it was destroyed. (TOS comic: "Devil Down Below!")
Vaal was a computer construct that engulfed a cavern whose entrance appeared as a dragon's mouth on the surface. It was capable of generating a tractor beam that was strong enough to send a starship crashing into the planet's surface. To protect itself, it would also generate a shield that was also capable of resisting phasers from a starship.
Within its structure, Vaal was capable of manipulating its environment and cause earthquakes or cause the ground to engulf its enemies. An individual hooked up to Vaal was capable of generating a holographic representation of themself to a ship that orbited the planet.