William Matthews aka Gog (the first one)is a character inspired in the graphic novel Kingdom Come. As both authors of that novel, Mark Waid and Alex Ross went in different ways, there were two versions of the character: the first one, (by Waid and Jerry Ordway), known as William Matthews appeared in New Year's Evil: Gog #1, (February 1998). The second one was created by Alex Ross, Geoff Johns and Dale Eaglesham, and appeared in Justice Society of America #13 - Thy Kingdom Come: Supermen (February 2008). Both characters are supposedly be tied to the character from Kingdom Come Magog.
Eventually both characters were tied together by retcon.
Originally, William was a child who survived to the destruction of Kansas, (events seen in Kingdom Come 1) and saved by Superman. He saw Superman as a savior of mankind and many years later, when he was already an adult man, he created a church worshipping the last son of Krypton. Depiste William good intentions, Superman dissapproved such idolatry, so he spoke to William, trying to convince him than he wasn't a godly being and in fact, he was the cause of the disaster happened in Kansas, because of his absence.
Without a guide, William felt himself lost, unsure to which path follow. Under such state, William was contacted by the Phantom Stranger, under orders of the Quintessence. The Stranger gave William a sealed scroll. When William opened the scroll, he was transformed and drove insane, as he saw glimpses of reality. Calling himself Gog, he vowed to kill Superman, believing heim to be the cause of every evil. Using his newfound powers, Gog killed Superman. Unsatisfied by his victory, Gog traveled 24 hours back in time, found Superman, and killed him again, repeating the process over and over, going backwards one day further each time, and each time varying the means of Superman's death and absorbing portions of the slain Supermen's power.
Such paradoxes were detected by the Linear Men who tried to stop the carnage of Gog the day of the birth of the son of Superman and Wonder Woman, in Paradise Island. The intervention of the Linear Men, along with the help of the Justice Leage of that time save the life of Superman, but also permited than Gog abducted the newborn child. Seeing his mission on danger, Gog decided to go many years to the past and cause the disaster of Kansas decades earlier. An event than according with the Linear Men, would cancel the existence of the Kingdom Come reality.
With the help of the present day Trinity, the Kingdom Come era Trinity and a improvised group of Titans, Rip Hunter and the Stranger stopped the rampage of Gog, trapping him in the Planet Krypton restaurant, secretely, an armory with weapons from different realities. In this scenario, Rip Hunter revealed the existence of Hypertime, as a validation of the multiplicity of alternate realities. Defeated, Gog is then returned to the future by Rip Hunter and the future versions of Superman, Batman, and Wonder Woman, who demand that the Quintessence restore him to the person he was.
Action Comics: In the Name of Gog
A second version of Gog with a different origin appeared several years later in DC continuity. This version of Gog is a survivor of Imperiex’ attack on Topeka, Kansas, seen in Our Worlds at war. He was saved by Superman, but Superman was unable to rescue the boy's parents. Desperate to fix what had gone wrong, William Matthews grew up researching the science of time travel in an effort to go back in time and rescue his family.
Eventually, he succeeds in his efforts at creating a time machine, but his first prototype is unable to travel far enough back. He refines the time machine for over two-hundred thousand years, making it more and more powerful and using the technology to give himself super-powers. He then gives his research and advanced technology to younger versions of himself, which gives him more power due to rewriting history over and over. Realizing that he could not save his parents due to a temporal paradox (the death of his parents triggered the creation of his powers) his desire grows from saving his parents to punishing Superman for their deaths. So give himself his own staff and prepare to defeat Superman. Through a series of manipulations, weakened Superman but it was not enoguh. Tired of failure, Gog reunited an army of temporal doppelganger to kill Superman, taken from 300 separated minutes in the future of his own life. In the final battle, Gog defeated Superman. This created a new timeline where Doomsday became a hero and inspire a new breed of heros who rise to fight against Gog.
Over the next two-hundred years, Doomsday leads an army in Superman's name against Gog. Meanwhile Gog tried to break Superman spirit by tempting him with the possibilities of time travel, if he kill the young William, but Superman refused, eventually breaking Gog's will of revenge and dies i n the arms of the heroic Doomsday. To cancel this future, the old Gog and the heroic Doomsday traveled back in time and killed one of the doppelgangers Gogs, erasing the army of Gogs and destroying the timeline. Meanwhile the old Gog and heroic Doomsday vanisghed from reality at peace, he warned Superman about the uncoming infinite crisis. Far from there, the younger, defeated Gog, teleported himself away from the scene of his defeat, preparing for a new attack.
JSA: Thy Kingdom Come
After infinite Crisis and with the reestablishment of the multiverse, the events of the Kingdom Come limited series were canonically placed on Earth-22 and the events of the Kingdom must be taken as an alternate future, product of hypertime dynamics. Gog's background changed due to the events of Infinite Crisis and the events of Action Comics were retconned, with all the experiences of Gog only can being attributed to the delirious mind of Matthews.
In the JSA title, Gog had started a crusade against every metahuman who claim to be gods by blasting holes through their chests and disintegrating their hearts. Some of his kills include the criminals Goth and Chroma and a group of beings calling themselves the New Olympians. The Infinity-Man and Hercules were two who survived his onslaught. After facing off against the Infinity-Man, he attacks Sandman who was spying on him, before taking on the Justice Society.
Meanwhile, the Superman from earth 22 had traveled to earth 0 just after the detonation of a bomb. Believing his earth destroyed found the native Superman of earth 0 to ask about Gog. Superman-0 explained to Superman-22 than he had doubts about Gog claims of beiing a time traveler and had investigated about him. He had discovered than Gog was a priest named William Matthews who had dissapered in Africa and later had returned with superpowers.
The following fight against Gog, Matthews himself revealed his history: he received his powers from an underground citadel in Africa and took the name Gog, inspired in the face of stone of the Old God called Gog. The power and the contact with the staff of Gog had been driven mad with visions of the Multiverse, including having visions of events of the past, the future seen on the Kingdom and the events of Earth-22, learning about the situation of Superman from that reality.
However, when the Justice Society follow him back to the citadel, his body was devored by the stone face on a wall. The stone face rises, becoming a massive stone man adorned in gold who claims to be the one, true Gog and disavowing any claim of Matthews as his agent.
The status of William Matthews/Gog after Rebirth is unknown.