The Riddler was originally Edward Nygma, who worked in the highly successful electronics division of Wayne Enterprises as a researcher. Though brilliant, he had serious psychological problems. He was able to keep these problems in check though, until his pet project to create a device capable of beaming TV signals directly into the brain was terminated by his supervisor, Fred Stickley. Edward went over Stickley's head and straight to Bruce Wayne, who he idolized to the point of obsession. However, Bruce felt that Edward's work was too controversial and refused to give him any additional funding.
Dejected, Edward snuck into the lab late one night to continue working on his device without permission, and was caught in the act by Stickley. Desperate, Edward knocked Stickley out by hitting him over the head with a coffee pot. Sensing an opportunity, he then hooked both Stickley and himself up to the device with the intention of showing him how well it worked. He ended up surprising even himself when the power of the device proved to have an interesting side-effect on Edward: By being connected to Stickley while the device was turned on, he found that he not only utilized Stickley's neural energy to grow more intelligent, but also could absorb Stickley's memories and knowledge.
After killing Stickley by shoving the unfortunate man out the window, Edward forged a suicide note in Stickley's handwriting and digitally edited the security camera footage to make it seem as though Stickley had killed himself. Then, under the guise of grief, he quit Wayne Enterprises and struck out on his own. Needing to steal production capital to fund his own company and mass-produce his device, which Edward had by this time started referring to as the Box, he adopted the guise of the Riddler. Knowing he couldn't do it alone, he recruitedTwo-Face and his gang to his cause after seeing them murder the family of Dick Grayson on live TV.
With Two-Face's help, the Riddler stole all the money he needed to build NygmaTech. NygmaTech mass-produced the Box, which soon sat on nearly every TV in Gotham City, sucking the brainwaves of Gothamites and beaming them directly to the Riddler in his hideout on Claw Island. As a side project of sorts, the Riddler began tormenting his former employer by sending Bruce Wayne multiple riddles (which would, eventually, allowed Bruce to deduce the Riddler's true identity). When Edward persuaded Bruce to try out the Box while his rival was attending his party at the Ritz Gotham, his device successfully mapped the billionaire's mind, revealing to both the Riddler and Two-Face the true identity of Batman.
In order to lure Batman and his new sidekick Robin to Claw Island, the Riddler sent Two-Face and his gang to attack Wayne Manor and kidnap Bruce's girlfriend Chase Meridian, while the Riddler himself, using the knowledge gained from Bruce's mind, invaded the Batcave and destroyed all of Batman's weapons and gear using little exploding green bat bombs. The plan worked, and Batman and Robin were soon en route to Claw Island in the Batwing and Batboat, both of which were destroyed by the NygmaTech building's defenses (patterned somewhat ludicrously after the boardgame Battleship).
Robin was captured by Two-Face, and then both he and Chase were imprisoned within glass cylinders hanging over an abyss. After revealing his mad plan to rule the world through sheer intelligence ("If knowledge is power, then a god am I."), the Riddler gave Batman a choice: At the push of a button he would release both Robin and Chase into the abyss, and the Dark Knight could only save one of them. Which would it be, he asked. Batman's partner, or the love of Bruce's life?
Of course, being Batman, he managed to save both of them and damage the main Box that fed all the information sucked from Gotham into the Riddler's head. This sent the device into reverse, sucking all of the stolen knowledge out of the Riddler's head, leaving Edward Nygma a literally broken, drained man. He was then taken by Batman to Arkham Asylum, where he remains there to this day under the care of Dr. Burton, screaming at all hours of the day and night that he is Batman.