The Black Company starts out with the can already having been opened but not all of the way in a bit of evil on evil backstabbery. Their employer was sealed away by the White Rose but then released by a group of sorcerers called the Resurrectionists. As thanks the Lady, a powerful sorceress who was sealed in there, kills them and then prevents her husband from getting out so she can keep the power to herself. He is not pleased and it's implied the world is doomed if he ever does get out. Once the Lady loses her powers and essentially switches sides against her former lieutenant, the Dominator is ultimately defeated and sealed in a silver spike, at which point is instantly reduced to ostensible Artifact of Doom and consummate MacGuffin that spawns a titular sequel chronicling the mad scramble to be the first wizard to obtain and unlock its secrets. Since the attempt to put the evil in a can inside another can that just happened to be the offspring of a Physical God was foiled miserably by a band of local scum, the Physical God drops it off in a Swirly Energy Thingy with assurances that the threat is vanquished forever, just like the even older Sealed Evil in a Can he himself guards.
Wyrm, the enormous, snakelike Eldritch Abomination that is the main villain of The Book of the Dun Cow, was sealed inside the earth during the creation of the world to stop him from destroying the universe. The aim of the main characters is to prevent his escape.
In John C. Wright's Chronicles of Chaos, children being held hostage by Greek gods are nevertheless not sure that their own parents are entirely in the right; they find out, in due course, that they are hostage to prevent the forces of Chaos from moving against the universe and destroying it. They set up themselves to live safely and free in the universe until the gods could stand against the forces, without going home and so triggering such a war.
In The Chronicles of Thomas Covenant, the Creator sealed his Evil Counterpart Lord Foul the Despiser in The Land in order to keep the rest of the universe safe. Unfortunately, the Creator didn't really think it through very well, as Lord Foul can now wreak havoc within The Land freely, and if the Creator tries to interfere directly, it'll let Lord Foul out and destroy the Arch of Time (the universe).
19th century example: The 1842 German novella Die schwarze Spinne (The Black Spider) by Jeremias Gotthelf: heavily steeped in Christian-conservative symbolism, the story, based on folktales, contrasts pastoral life with satanic influences. The titular black spider (a metaphor for the Black Plague) is created when a ruthless knight baron forces the peasants of a remote valley in the Alps to work themselves nearly to death. The devil in the form of a wild huntsman offers the desperate peasants his help, in exchange for a yet unborn unchristened child. The only person who is willing to strike such a pact is a farmer's wife (and originally a foreigner, adding a touch of xenophobia). The devil kisses her cheek; from this kiss grows an evil tumor in the form of a black spider. Twice, when the devil comes to collect a newborn, the local priest baptizes the child in the nick of time, but as punishment, the monstrous spider, now adult, births thousands of tiny spiders that start killing livestock and people, and finally breaks free from the face of the farmer's wife (who dies) and kills the priest and baby. The spider is finally sealed away when a brave mother, to protect her own newborn, grabs it and, dying, imprisons it in a hole in a wooden beam of her house, into which she hammers a peg to seal away the spider forever. Generations later, when people have stopped believing in the tale and become "sinful", a bragging servant pulls out the peg on a drunken bet and releases the devil spider, until it can again be sealed away by a pious woman who remembers the old tales and sacrifices her life for her child.
Not truly evil, but definitely not good. In the Discworld novel Hogfather, Archchancellor Ridcully decides to unseal the door to a special bathtub invented by Bergoldt Stuttley "Bloody Stupid" Johnson, simply because it was barred shut. When asked why he wanted it opened, he replied, "To see why they wanted it shut, of course!" Terry Pratchett added the following footnote:
This exchange contains almost all you need to know about human civilization. At least, those bits of it that are not under the sea, fenced off or still smoking.
Pratchett also explores this theme in Reaper Man, where, in a time when Death is non-existent, Evil returns in the form of dinky little snow-globes that people want to love and cherish, since as you pick them up and shake them, snow appears to fall around models of city landmarks, and look, they'e even labelled A Present From Ankh-Morpork, how cool is that? But the globes are seeds of a potent and cruel ancestral evil that preys upon and kills cities....
In the Dragonlance novels, and D&D campaign setting, Takhisis was essentially a sealed evil in a can from the end of the Third Dragonwar, when Huma Dragonbane forced her to swear to leave Krynn and never return, and the Cataclysm, when she found a way to get around that oath. In an interesting variation on this trope, it was when Berem stole the emerald from the pillar of Takhisis' temple, killing his sister Jasla in the process, that Takhisis was partially resealed.
She was actually able to get around her oath because of the Cataclysm — its precise wording was that she would never return "while the world was whole". With half the main continent blown up, the world was no longer whole so she was able to return. It's a bit of a stretch, but Takhisis is the Queen of Darkness.
In "The Wizards Are Dying", the godling lich Xanthak is released from imprisonment when a group of adventurers takes a jeweled cross called the Nga from the door that seals his cell. Another group of adventurers has to put him back in his cell and seal it again.
"Out of the Eons", one of Gardner F. Fox's "Niall of the Far Travels" short stories. Adonair is an evil deity from another universe trapped in a brick-lined cubicle eons ago by the deities of Niall's universe. During the course of the story Niall accidentally releases him and he and the gods must find a way to destroy him.
Oh, and in book 11, Harry becomes its Warden, a position which among other things grants him the authority to release any of the prisoners. Which also means that if Demonreach is a giant can full of the most terrifying evils in the world, then Harry has got the can opener.
In the Stephen King novel Duma Key, the villain, Perse, is an evil doll/creature who is sealed in a keg which was dropped down a well. Unfortunately, the keg had been leaking for some time and by the time the main character finds it, it's almost empty. He eventually ends up sealing Perse in a flashlight filled with water (her weakness) and eventually creates a tight, silver container to hold that it and throws it into a lake.
Another king example is the short story "The Crate", later adapted as one of the segments of Creepshow, where a crate containing a terrible monster is opened by a janitor.
The blade Stormbringer in the Elric saga by Michael Moorcock straddles the border between this and Evil Weapon as it is both the form of an Eldritch Abomination that it takes on the mortal plane, and is the trap it is bound into. At the end of the saga, it finally breaks free as it is forced to consume a truly indestructible soul, Elric's, and is finally free to race through the universe, the last bit of Chaos left to supply growth and change in a universe of Law — supposedly this one.
Fred Saberhagen's Empire of the East did this in an interesting way: the Demon-Prince Orcus, who founded the titular Empire, was imprisoned under the earth by his own lieutenants, John Ominor and Wood, in a coup. Eventually, Wood convinces Ominor that they should release Orcus, believing that only Orcus has the power to match Ardneh, and believing that they can keep Orcus controlled. They were right about the first point, barely. About the second, they were wrong. Also, Ardneh tricked them into releasing Orcus so that he could destroy Orcus and the Empire in a single stroke.
Fablehaven has several examples of these, most notably the demons of Zzyzx.
In the late James Herbert's novel The Fog (unrelated to the John Carpenter film of the same name), an earthquake ruptures a buried canister, releasing an insubstantial, misty organism called a mycoplasm. Otherwise respectable people do decidedly hideous things when they come into contact with it.
While not a single character, the Mijaki were confined to the borders of their lands in Karen Miller's Godspeaker Trilogy because they made the world evil. Hekat then decides to change things.
Morhavon the Black and the place under the palace catacombs where evil spirits are sealed away from the Green Rider series.
Also in the same volume, Tom Riddle's diary has the "memory" of the teenage Voldemort sealed inside, which Ginny unknowingly awakens through her liberal use of the diary.
In Harry Potter and the Deathly Hallows, it's implied that Voldemort's final fate is to remain in a sort of limbo (specifically, the netherworld where Harry met Dumbledore after he died) forever, incapable of harming anyone ever again.
The Damned, from Hell's Children, by Andrew Boland, are sealed evil in a can, who spend the entire book trying to get out.
Another Wilson co-wrote the illuminatus series of books. This includes the idea that one of the foullest and most vicious Shoggoths was in antiquity sealed in a pentagonal prison somewhere on the eastern North American plain, appeased with the blood and souls of those who died un-natural deaths. The secret of the pentagon was passed down through a series of custodians, the last of whom built a five-sided building complex around it from which the leaders of that continent's strongest power organised escalating wars, so as to appease the beast and keep it in souls. Hiding the secret in plain sight, they even called their prison building complex The Pentagon.
In Killdozer! by Theodore Sturgeon the construction crew on a Pacific island accidentally releases a being that can possess any metal object and only wishes to kill. The being got sealed in a neutronium sphere by accident and survived while its relatives and their accidental creators destroyed each other (killing all life on Earth in the process too).
Larry Niven's World of Ptavvs has a scientific team accidentally releasing a Slaver, an ancient alien with large-scale mind control powers and an intense attitude problem, from the stasis field it has been trapped in for a billion years.
Daniel Keys Moran's The Last Dancer has a scientific team releasing an ancient human, whose physical conditioning and skills approach Badass Normal from the other side and who has a major attitude problem (compare World of Ptavvs above). He proceeds to spend the rest of the book mainly kicking the otherBig Bad's ass, making him not so much Evil, just Sealed Badass In A Can.
And it's only the most obvious. The Laundry Series' world is full of various eldritch abominations sealed in cans of various shapes and colors with different opening protocols. You have the Sleeper in the Pyramid, the Infovore, the Deep One in Jennifer Morgue, the Eater of Souls, ... And the Laundry and its sister agencies' job is to make sure that everyone remains in his can.
In James Alan Gardner's Hunted, the Mandasars have queens who are very smart, very large, very strong, can persuade other Mandasars to do anything by emitting the right pheromones, and are physiologically hardwired so that each queen believes that she is the most competent person around and should be in charge. Having more than about four of them on the planet tends to mean endless power struggles; having that few risks having them all die. The solution implemented is to have a bunch of queens in cryonic storage. While they aren't evil per se, waking them all up at once is still really, really bad.
The T'lan Imass of the Malazan Book of the Fallen are notable offenders for this. During their genocidal war against the Jaghut and, off-and-on, the Forkrul Assail, they developed a ritual for binding enemies when they lacked the strength to directly kill them. Either pinned under massive stone slabs or buried in barrows, it's not uncommon for their ancient enemies to be unearthed.
The Azath House seals away both good and evil, trapping them until such a time as they are needed in the world or the Azath dies.
It's not entirely clear who was doing the sealing, but there have also been cases of bound K'Chain Che'Malle who predate even the T'lan Imass.
In Memory, Sorrow, and Thorn, the Big Bad, Ineluki, is a Sithi sorcerer who went mad trying to protect his people from the onslaught of mankind. He cast a forbidden spell in an attempt to destroy the conquering army, but killed himself instead. Even in death, however, his hatred burned so strongly that his spirit refused to leave the world, lingering instead in the realms beyond death for five hundred years, until the circumstances become right for him to be freed via a complex ritual involving Demonic Possession. It is stated outright that if he succeeds he will destroy all living things in his longing for Unbeing.
In Mistborn, Ruin, the primal force of chaos and destruction was imprisoned by his "good" counterpart Preservation after they teamed up to create life. This is a bit more complicated than most examples because Preservation split Ruin apart to make his release more difficult. Ruin's mind was put in the Well of Ascension, while the bulk of his power was bound into the atium. The problem was, even an imprisoned Ruin still had some power, so he altered the prophecies regarding a messianic figure called the Hero of Ages to say that the Hero should go to the Well of Ascension and release its power to the being trapped there. Following the prophecy, the heroine of the trilogy does this. Oops.
The Tessier-Ashpools in "Literature/Neuromancer" repeatedly freeze themselves to maintain the dynasty. They're arguably more selfish and prideful than evil, but they do also keep a ninja on ice.
In Neverwhere, the angel Islington is situated in the center of a labyrinth deep, deep underground. It turns out that this is for a very good reason: He was trapped there as punishment for destroying Atlantis.
Peter F. Hamilton does this in at least two series: in The Night's Dawn Trilogy Series, a wandering alien accidentally opens a portal to the afterlife, and in Pandora's Star and Judas Unchained, an alien menace is released by its hidden enemy (who has arranged a long-term "Let's You and Him Fight" situation between the menace and humanity).
Initially in Percy Jackson and the Olympians, Kronos' remains are just in a particularly creepy sarcophagus that gets stronger every time a demigod forsakes the Olympians and joins his side. Later, Luke graduates to being his Soul Jar.
Gonko: You come get your chuckles whenever you're ready, 'cause if they ain't lettin' me go, they ain't lettin' you go. Best believe that. Show's down but not out, mark my words. We'll be back in town, my pretty, and I don't recall offering you a severance package.
The initial premise of The Riftwar Cycle is that the God of Evil was imprisoned by the other surviving gods, but is now reaching out to influence things. Later books introduce successive complications, but those drift rapidly away from this trope.
The Silmarillion ends with the sealing of Evil OverlordMorgoth in the void beyond the boundaries of the world. He never escapes, though it is implied that Sauron was trying to find some way to release him during the Second Age.
Morgoth also spends 3,000 years in a can as punishment by the Valar. Eventually, because Good Cannot Comprehend Evil, they let him out for good behaviour, thinking he's repented. He hasn't.
Colin Wilson's The Space Vampires has a space mission to find a derelict ship drifting in the solar system. The astronauts board it and retrieve what they believe to be several human-like alien bodies. It turns out they're possessed by evil energy beings that live off the life energies of others. The very pulpy movie adaptation (called Lifeforce) has a similar initial situation, though it diverges pretty massively after that (the aliens turn their victims into zombies).
Subverted in M. T. Anderson's book Thirsty, in which a group of vampires are trying to free the Sealed Evil, the god of vampires, and one character pretends to be trying to kill the vampire god in order to protect humanity, but in reality is assisting the god in committing suicide.
The insane clone Dark Jedi Master Joruus C'baoth more or less sealed himself, ending up on the planet that The Emperor used as a personal museum/storehouse. C'baoth had no interest in the storehouse facility even after killing its guardian, and inhabitants of the planet had roughly feudal levels of technology. So he stayed there and ruled them, using his raw Force abilities and sort of mass mind-control to keep them cowed and obedient. Then Grand Admiral Thrawn showed up and recruited C'baoth with promises of new Force-sensitives to train and mold, both because C'baoth's Battle Meditation could allow great synchronization and increased efficiency in the fleet, and because he wanted the cloning technology in the facility. Thrawn's second in command really did not want to rely at all on someone so unreliable, but he was overruled. C'baoth's inevitable attempt at seizing power involved taking control of the entire Imperial fleet; when Thrawn talked him down and sent him back to that planet, C'baoth's next plan started with brainwashing an officer to the point where he had no will or mind anymore and died shortly after being taken away from the insane Master.
Another example of sorts in the same trilogy — an insane Bpfasshi Dark Jedi had been killed by Yoda on Dagobah, and his essence infused the tree where Luke had his pivotal vision during The Empire Strikes Back.
Another example from the Star Wars Expanded Universe: insane Eldritch Abomination Abeloth was sealed in a massive cluster of black holes, with a gravity-generating space station acting as a lock keeping her trapped there and unable to influence things on the physical place, and the Anthropomorphic Personification of the Light Side and the Dark Side of the Force doing an Enemy Mine every few thousand years to renew the lock whenever it started to break. This took the heroes over half a century to break; Anakin Skywalker killed the locksmiths, later protagonists broke the space station (they thought it was just a superweapon and didn't want it falling into the wrong hands), and then they used the black hole cluster where the ethereal monster was kept as a fortress. It still managed to keep her for about a decade.
Four hundred years before Galaxy of Fear, Ithorians tinkered with gene splicing and created something horrible. It took the Jedi to contain it. The Ithorians' Actual Pacifist beliefs make them averse to driving anything to extinction, so they isolated a sample and buried it in a tunnel in an asteroid. It was harmless sealed in a pod in the vacuum of space. Unfortunately they didn't bother with keeping a guard on it, so when someone Dug Too Deep...
Arguably, a lot of the The Immortals of Tamora Pierce's Tortall Universe series, after a bunch of mages locked them up in the Realms of the Gods. It didn't stick. Many of them are benign and decide to adapt to living with humans, but some are persistently vicious. Particularly giant human-headed spiders called spidrens, and a species of predatory flying horse called hurroks.
In the series The Wheel of Time, the Dark One is making good progress in eroding the makeshift seal on the hole in the Creator-made prison that's kept it imprisoned for thousands of years. The hole was made back during what is known by the timeline of the books as the Age of Legends, although they did manage to patch it up again as best they could. Being as it is the God of Evil, existing outside reality, sealing and resealing really is the only option. During his resealing, his 13 highest-ranking disciples were sealed (mostly) outside of time as well, they ended up being freed first to pave the way for his return.
Stasis Boxes fit this trope when used for preserving the Gholams, not-quite-undead super assassins from the War of Power, beyond time and space.
How about Mierin's experiment in the Age of Legends that let the Dark One out in the first place? Even better because back then, nobody knew the Dark One existed, and her experiment was intended to tap a greater source of magical power able to be used by men and women (as opposed to the separate halfs of the one power). She later became Lanfear, one of the Forsaken, the most powerful servants of the dark one, though judging by a bit of Aiel ancestral memory that is tapped into, she was not evil to begin with, ie at the time of her experiment (as part of a team).
Mordeth/Mashadar is/are unable to leave Shadar Logoth after the fall of Aridhol (why is never really explained, but perhaps it was sealed intentionally). Mat Cauthon (or Padan Fain, or both) release it into the world at large after Mat removes the dagger. The can later is completely obliterated while cleansing sai'din.
With Friends Like These... by Alan Dean Foster: Humanity was sealed under a forcefield a long time ago because we scared the aliens that badly. When aliens later release the humans in exchange for helping them against a bigger menace, one of the aliens has the sense to worry, "What happens when we run out of enemies?".
In Who Censored Roger Rabbit?, it turns out that the titular murderer is a genie imprisoned in a Persian teapot that can only be released by a bonafide toon, who is sick of taking orders from self-centered people and starts deliberately spoiling the toons' wishes, until finally he just flat-out starts murdering them.
North Korea in World War Z. One day, in the early stages of the Zombie War, the entire country simply disappeared — DIA spy satellites stopped picking up any activity or indeed signs of life within the Democratic People's Republic. The best bet is that the entire population relocated to massive underground bunkers. Nothing has been heard since, which means one of two things: Either one of them was infected, or none of them were. In the former case, that means one of two things: either they controlled the outbreak, or they did not. If the didn't, then 24 million Zombies are waiting beneath the surface, trapped in the tunnel system, and Communist architecture - well, it ain't all that good. If no-one was infected and/or they managed to control the outbreak, then 24 million fanatical, nuclear armed fascists are waiting on one side of the Korean DMZ, and when they find out how weak the rest of humanity is...
In Deep Wizardry, the second Young Wizards novel, the seal on the Lone Power's can is weakening and needs to be recharged. However, what is sealed is only one aspect out of many that the Lone Power possesses, so It can be safely sealed away in one place while simultaneously being an active menace somewhere else.
Then in A Wizard's Holiday, the protagonists have to, among other things, open the seal and let the Lone Power out.
Christopher Moore is a big fan of this trope, most notably in Practical Demonkeeping (Catch, the titular demon, is actually sealed away in a jar), Lamb Baltazaar keeps Catch, the same demon from the earlier novel, in a magically-sealed room which he tells Biff to stay away from. (Schmuck Bait) and You Suck.
Cthulhu. Indeed, most Cosmic Horror uses a can of some sort to explain why the super-powerful beings haven't already destroyed humanity. In this case, however, nobody appears to have done the actual sealing or unsealing; the elder gods are just "sleeping", and will awaken "when the stars are right".
However, the Great Old Ones are not evil per se (save perhaps Nyarlathotep, and he is not always classed as one, and is properly an Outer God, ) but uncaring - they are simply far too powerful for us to matter to them, rather like a human stepping on ants (or for a better example, but purely Scots, the midge) and/or simply mindless - Azathoth for example, could (and apparently will) destroy everything, but he is blind, deaf, mute and completely unintelligent,and is no more evil than a hurricane.
Another example in Lovecraft's work is The Haunter of the Dark, an avatar of the god Nyarlatotep who is sealed inside the shining trapezohedron and can be summoned by gazing into it. Unlike the Great Old Ones, summoning him doesn't result in the end of the world, but he most likely wants some human sacrifices in exchange for secret knowledge or wants to possess you in order to get mankind to blow itself up.
Quite a few of John Connolly's short stories involve Sealed Evil in a Can: the Daemon buried under the church in "Mr Pettinger's Daemon"; the Fairies trapped inside their fort in "The New Daughter"; the monster chained up at the bottom of the lake in "Deep Dark Green"; the nest of hibernating giant spiders in "The Wakeford Abyss"...
Also, in his novel The Black Angel, the fallen angel Immael is plunged into a vat of molten silver during the Back Story and the resulting statue becomes the angel's prison for several centuries. Naturally, the novel itself is all about Immael's twin brother and his followers attempting to free him.
One of M. R. James’s favorite tropes was having an unpleasant being imprisoned in a tomb, grave, or ruin, inevitably later disturbed. Stories in this pattern include "Count Magnus" (the count's sarcophagus has three padlocks on it), "An Episode of Cathedral History", and "The Rose Garden".
Alex Verus encounters two of these. One is a magician who sealed himself in an artifact. The other is a magician who is trying to live forever by killing others like the long dead vampires.