The Nuremberg Trials tried for a combination of any of the four crimes listed below:
Participation in a common plan or conspiracy for the accomplishment of a crime against peace
Planning, initiating and waging wars of aggression and other crimes against peace
Participating in War crimes
Crimes against humanity
All defendants were in high positions of power in the government or flag officers in the military of Germany, though several industrialists were also tried. The crimes in the case were largely related to the war, though the crimes against humanity mostly stemming from slave labor.
The Trials tried 24 individuals and seven organizations for their role in the planning of and participation in a war of aggression and most of the specifics of the cases fell under treaty agreement or in accordance with the Leipzig War Crimes Tribunal held following World War I. The rules of the trial were agreed upon at the Yalta conference prior to the war's end and Germany had legally agreed to the trial in the signing of the Instruments of Surrender of Germany, which had ended the war in Europe.
The Instruments of Surrender effectively transferred all legal and political responsibilities of Germany to the Allied Control Council (ACC) and per rules, those indicted by the trial were only tried for crimes that were committed on or after September 1, 1939 (the start of the War, and thus the legal start of the laws enforced by ACC at the trial).
Additionally, there were several legal, practical, and symbolic reasons for Nuremberg being the location of the trial. Symbolically it was the birth place of the Nazi Party. Practically, it the palace of justice was intact, large enough, and had a jail on premisis, all difficult things to find in combination in a war torn nation. Legally, and perhaps most importantly, Nuremberg was on the American sector of Occupided Germany. This matters because American Law uses the Common law system instead of Civil Law systems found in Germany. Common Law requires the use of precedence (new trials should find in similar ways for similar circumstances) as a fundamental tennent, where as in Civil law systems use it as an advisement. Since there had already been a War Crimes Tribunal the last time Europe was at war, the decisions there set "Case Law" used by these courts.
And Germany wasn't about to protest this for a number of reasons. Even if they could get concessions on the trial venue that might have put the matter in their favor and ignoring the new laws of the land that said these were crimes from day one of the war, they'd have to argue for another of the allied nations as their trial place: The problem was, every option was worse.
The Soviets were feared by the surrendering Nazis as they were rather brutal following surrenders and were vindictive from the surprise war in violation of non-aggression pacts.
The French Civil law as quite close to German Law, but the French were just as vindictive over the little matter of the occupation and their reconstituted government was lead by Charles de Galle, who was a major French Resistance Leader famous for fighting with Allied Leaders as fiercely as they fought with the Germans. It was better than the Soviets... but that's not a high bar of praise.
Finally, the British were no good because they were probably in very close agreement to the American's position and it didn't help that the Americans used Common Law legal systems since before there was America... and while not invaded, the British were probably a little cross with Germany over the Battle of Britian. Oh... and they kinda owed one or two to the Americans over their better late than never save.
All the Americans were really concerned about was the fact that they had to go to Europe to fight one of their wars... again, which is still a bit of a prejudicial element that should be avoided in trials...but considering the others, they were far and away the closest to unbiased arbiters the Germans had.
And that's just The Neruemberg trials as there were actually a few that were conducted there, but the rest were conducted under American's authority over that sector of post-war Germany (this was the one that got to the meat and potatoes of the Holocaust related crimes. Its here where I need to remind you that Common Law need not have a codified law to declare something illegal (unlike German Law) and there are some places in the United States that don't have codified laws for murder because the case laws are so strong that Murder is illegal anyway (I know Maryland is one such state... It's got a lot to due with it being an original colony that had long said murder is wrong before it was a state... though I like to joke that the murder rate in Baltimore is so bad, that there is no way to kill a man that won't get Maryland courts to say "seen it all before"). Since most of the crimes in the death camps were murder under American jurisprudence... and since these trials followed military tribunal laws... well... it's not post ipso facto.
By the way, that common law vs. civil law thing is why "Just Following Orders" is a thing. It's not that the Nazis thought it was a defense against the charged crimes, but an argument for a lesser crime. Under German law, the severity of murder is determined by the reason for murder. A crime of passion is a stricter sentence then a dispassionate crime, like a military soldier killing someone because of an order. In Common Law, at trial, the severity of murder is determined by whether or not you planned to commit murder, not your reason for doing that. That stuff is brought up during sentencing which only happens if your found guilty. So while the Germans thought this would help, to the British and Americans, this just confirmed the worst severity... and the French and Soviets were perfectly fine with this because of obvious reasons.