Gillain makes his first appearance in Frank Miller's Batman: Year One as the corrupt Gotham City Police Commissioner who was on the payrole of mob boss Carmine Falcone and had hired Lieutenant James Gordon. Loeb originally took no action against Batman, as he was only targeting low level criminals at the time, and he gave the public "false" hope. This changed when Batman attacked a party organised by Falcone in which Loeb was in attendence, where he publicly declared he would bring them to justice.
The enraged Loeb sent armies of officers against the Bat, but his attempts failed to bring the vigilante to "justice". When Gordon began assisting the caped crusader, Loeb attemtped to blackmail him with evidence of the former's affair with Sgt. Sarah Essen, but Gordon confessed his infidelity to his wife Barbara. Later, Batman, Harvey Dent, and Gordon revealed to the public of Loeb's workings with Falcone's mob, so the corrupt officer was forced to resign. He was replaced by Jack Grogan, who was just as corrupt as his predececessor; Gordon would become police commissioner a few years later.
In Batman: Dark Victory, Loeb sided with the Hangman in the hopes of digracing Gordon and regaining his former position, where Loeb was eventually killed by his own partner.
In the New 52 continuity, during the Batman: Zero Year (the New 52 remake of Batman: Year One) Loeb did start as corrupt, but after the event, he chose to resign after learning that Black Mask had killed some his men because he felt responsible for allowing his department to become too corrupt.
Batman: Arkham Origins
Loeb appears in the Batman: Arkham Asylum prequel, Batman: Arkham Origins, as, yet again, a corrupt police officer in charge of the GCPD. However, he was betrayed by The Joker (who was impersonating Black Mask) where Loeb was thrown into Blackgate Prison's execution chamber (which was meant for the Calendar Man) and was killed via gas before a young Batman could help.
Later in the game under the influence of Copperhead's neurotoxin, Batman hallucinates Loeb chastising him for not helping him, representing Batman's guilt over not being able to save the corrupt commissioner before he was murdered.
Gilliam Loeb appears in the TV Series Gotham and as a supporting antagonist in the first season.