John Gill was a 23rd century historian. Spock was impressed by Gill's treatment of Earth history as "causes and motivations rather than dates and events." James T. Kirk, who studied under Gill at Starfleet Academy, remembered him as "the kindest gentlest man I ever knew." (TOS: "Patterns of Force")
In the mid 2260s, John Gill was stationed on the planet Ekos as a Federation cultural observer. As with other cultural observation and research missions that have been conducted, the Professor was probably sent there in disguise with a plausible cover story, so as to avoid interfering with the culture's development. However, when arrived he saw that the planet was in serious difficulty and decided to use his knowledge to help the local people. To this end, he created a version of Nazi Germany on the planet that was focused on social and economic renewal without the racial and/or religious persecution that marked the first Nazi State on Earth. Professor Gill provided much needed structure to the society by giving the local people the Nazis' richly symbolic culture to build on.
When Captain Kirk and Commander Spock beamed down to Ekos, they were stunned to find a mid-20th century style Nazi state bent on destroying the neighboring planet, Zeon, and all the Zeons living on Ekos. Kirk and Spock were also shocked to learn that John Gill had somehow become the Führer of Ekos.
When Kirk finally managed to locate Gill, the captain found his old history professor in extremely bad health. Apparently, Gill had been drugged by the Deputy Führer, Melakon. After Dr. McCoy administered several injections of a stimulant into Gill's body, Spock performed a mind meld on the historian, enabling Gill to answer Kirk's questions. Gill claimed that when he had first arrived on Ekos, he had found the planet in such a fragmented and divided state that he decided to break the Prime Directive in order to transform Ekos into a simulation of the most efficient state Earth had ever known. According to Gill, his plan had initially worked until Melakon began to drug him.
As Gill's attention returned to his current situation, Kirk urged the historian to notify the Ekosians of Melakon's betrayal before the Final Decision to destroy Zeon began. Gill was able to transmit a message to the Ekosians and tell them to stop the invasion of Zeon. He also apologized to Zeon, insisting that he himself, not the people of Ekos, bore the blame for this aggression. He then denounced Melakon as a traitor, at which point the Deputy Führer grabbed a soldier's machine gun and shot Gill before he himself was killed by Isak. Before Gill died, he admitted to Kirk he was wrong to violate the Prime Directive. (TOS: "Patterns of Force")
In the non-canon reference book the Star Fleet Medical Reference Manual, an essay titled "Historical Trends in Medicine" by John Gill, serves as the introduction. He is listed as holding the academic degree of Doctor of Philosophy ("Ph.D."), and it references several historical medical landmark works, such as The Surgeons Mate--a real-life Navy guide written in the 17th century, and several from the Star Trek universe.
Publications by John Gill, e.g., "Small Steps and Giant Leaps: A History of Humankind in the Galaxy" from 2143 or a multi-volume series about World War III, are also mentioned in the non-canon reference book Star Trek: Federation - The First 150 Years.