Ganon was once the evil warrior-sorcerer king of the Gerudo Thieves, Ganondorf. He claimed the vast, corrupting might of the Triforce of Power, and became as a god. He was defeated by the first of the warriors known as Link, and entrapped- after being transformed into a monster by the Triforce's magic- in the Light World by the Seven Sages.
As centuries passed, Ganon corrupted the purity of the Light World, turning it into the Dark World. Finally, Ganon convinced the wizard Agahnim to help him escape by transferring the descendant of the seventh Sage, Princess Zelda, into the Dark World. Ganon's escape was narrowly stopped by a second Link.
More time passed, and Ganon's power continued to weaken. He somehow made his way to the "real" world, kidnapped the current Princess Zelda, and shattered the Triforce of Wisdom. A third Link managed to reforge the Triforce of Wisdom and defeat Ganon once more.
Ganon manifested one final time as Shadow Link, given that form by the guardian of the Triforce of Courage. Shadow Link was defeated by Link in the Great Palace of the Eastern Continent. He was defeated again, perhaps for the final time.