At the end of 1408, Mike Enslin is informed that his only way out of the evil room is suicide, and helpfully provided with a noose. Deciding he'd rather go out on his own terms, he makes a Molotov Cocktail out of a bottle of cognac, sets the bed on fire, then - with some appropriate final words - smashes the window, causing a backdraft to destroy the room. (Whether or not Enslin himself survives depends which ending you're watching.)
Alien Nation: When George Francisco is raiding the club where the alien drug dealer with his horrible drug was hiding, he held a plastique explosive charge in his hand (minions of the said dealer wanted to wire it to his partners car earlier) and declared, that taking out the dealer and his drug is even worth dying for... Considering the side effects and the use of the drug back in his slave time, this is understandable.
Subverted in the B-movie Anacondas: Trail of Blood, when a Mook faced with a nigh-unstoppable giant snake pulls the pins from his grenade-belt and waits for it to swallow him, so they'll blow up together. Hot on the scent-trail of someone else, the snake slithers right past the guy, who's so dumbfounded that he forgets to throw the grenades away and blows himself up.
Bangkok Dangerous has Joe committing suicide to kill his target, Surat, by putting their heads together.
In John Wayne's film version of the Battle Of The Alamo, the hero manages to touch off the fort's powder storage, annihilating the victorious Mexican troops. In the real battle, a soldier tried this, but was killed in the attempt.
Beetlejuice — when Charles Deetz ineffectually tries to stand up to wife Delia's decorating plans, she vows, voice rising to a psychotic shriek, that if she can't gut the house and make it her own, "I will go insane, AND I WILL TAKE YOU WITH ME!!!"
Subverted in The Cabin in the Woods. A security officer blows himself up with a hand grenade as he's being gutted by Scary Scarecrows, but the blast stuns a nearby colleague armed with a submachine gun, leaving him helpless against a monster that crawls slowly towards him.
Christine is capable of self-restoration, and thus damages herself multiple times while killing Buddy's gang. Most noticeably is when she blows up the gas station while she's inside, effectively turning herself into a driving fireball.
Demon Knight, a movie produced under the Tales from the Crypt banner. A seriously maimed mother type and the deputy who loves her decide to go out big-grenade style in order to destroy many of the monster's minions.
In Diary of the Dead, when Samuel is bitten by a zombie, he impales himself and the zombie through the head with a scythe in one move.
At the end of Dog Soldiers, Sarge — who's slowly turning into a werewolf himself — triggers a gas explosion, blowing up the cabin in order to kill both himself and the rest of the werewolf pack.
In the film of Double Indemnity, after being shot by Phyllis, Neff kills her before going to record his confession.
The film Dragonslayer has sacrifice as the way to, well, slay the dragon.
In Dr. Strangelove, the Soviets build a cobalt bomb capable of annihilating all life on Earth. It will be set off automatically if anyone makes a nuclear attack on the USSR. Unfortunately, they forget to tell anyone (they were planning on announcing it on the following Monday, because "the Premier loves surprises").
In Edge of Tomorrow the protagonist, William Cage, observes a soldier strapping a Claymore to his chest while suiting up for battle, presumably to do just this if necessary. The soldier dies without getting the chance, but Cage is able to grab the Claymore and does it himself just as he is charged by one of the aliens. His success gets him 'infected' with the alien's time-resetting power. The Claymore then reappears in the final battle, on the same soldier. This time he successfully uses it to stop a charging wave of aliens.
In Elysium Kruger tries to blow himself and Max up with a grenade at the end of their fight. It doesn't work out as he intended.
Adapting actual legend, the Excalibur movie has a dramatic scene where Arthur successfully runs Mordren through, and Mordred leans forward and pulls the sword deeper as he dies to get close enough to stab Arthur back. Then they both die. This has been said to have happened to Arthur since the seventh century, before he was even consistently called Arthur. He and Mordred mutual killed before there was Camelot, or Guinevere, or even Merlin.
At the end of Flaming Brothers, with the last person that could see Ko prosecuted dead and both Alan and Tin out of options, they charge forward waving their empty guns at Ko and get both themselves and the villain killed by the waiting police.
In 4Closed, Forrest has rigged the house with explosives with the idea of making it look like Jake, the husband, blew up the house. When the Turners start to escape him, he pushes the switch while still inside, hoping to catch them in the blast.
In The General's Daughter, the killer deliberately steps on a landmine in an attempt to blow up Brenner and Sunhill along with himself. He's the only one caught in the blast.
The Godfather Part II has a scene where Michael Corleone realizes that investing in Cuba may not be such a good idea...
Michael: I saw an interesting thing happen today. A rebel was being arrested by the military police, and rather than be taken alive, he exploded a grenade he had hidden in his jacket. He killed himself, and took a captain of the command with him. Right Johnny. Johnny Ola: Those rebels, you know, they're lunatics. Michael: Maybe so — but it occurred to me. The soldiers are paid to fight — the rebels aren't. Hyman Roth: What does that tell you? Michael: They can win.
In The Great Santini, gentle and kindly Toomer is shot by Red, a racist redneck who'd been harassing him for his entire life. Toomer, knowing he's dying, gets payback for a lifetime of harassment by stumbling to his front door and opening it just before passing out from blood loss. He wasn't trying to get help, he opened the door to release his pack of extremely vicious dogs. Said dogs proceed to rip Red to pieces. Red's face, when he sees Toomer stumbling to the door and knows exactly what's about to happen, is nothing but pure Oh, Crap!. He knows he's a dead man.
The Grey Zone: Oberscharfuehrer Muhsfeld expresses this attitude about the genocide he's a part of after shooting Hesch, fully cognizant of the fact that the war is going to end badly for the Nazis.
Muhsfeld: That is how it will go for all of us. First you, then us. The last thing to do is smile. We will dispose of as many of you as we can before they do the same to us. Your bombers only speed it all up!
Harry Potter: Done twice with Harry and Voldemort. Harry Potter and the Chamber of Secrets has a dying Harry (from basilisk venom) realize that the memory of Tom is linked to the diary that is on the ground next to Ginny's body. Before Tom realizes it, Harry stumbles over and stabs the diary with one of the Basilisk fangs, destroying the image of Riddle. Later done in Harry Potter and the Deathly Hallows, when Harry attempts this at one point during the final battle, attempting to throw himself and Voldemort off of a rampart to their death.
Harry: Come on, Tom. Let's finish this the way we started... together!
Hobo with a Shotgun ends with the Hobo poised to be fired upon by every cop in the city as he stands over the corrupt crime lord who put the city through Hell. He pumps his shotgun and blows him away, letting the dirty cops kill him as well.
"We're taking a car ride to Hell, AND YOU'RE RIDING SHOTGUN."
Cato in the climax to the film adaptation to The Hunger Games does a variation of the trope. During the final battle between him, Peeta, and Katniss, Cato attempts to use Peeta as a Human Shield against Katniss, and is trying to goad her into shooting him, implying that by that point, he doesn't really care anymore if he survives the games or not.
In The Hunger Games: Mockingjay Part 1, Katniss tells Snow that this is what would happen to him, "If we burn, you burn with us". This is quoted in District 7 when they ambush the Peacekeepers. Later District 5 literally does this by destroying a hydroelectric plant that kills power at the capital on a suicide mission.
In the 2007 film version of I Am Legend, Neville sets off a grenade that kills himself and a horde of invading infected.
Russell Casse from the movie Independence Day pulls one of these with his fighter on an alien ship's core after his missile failed to fire, and proceeds to take the entire ship with him. By hitting the ship's charging weapon. "Hello, boys! I'm baacck!".
In Iron Man 2upon his defeat, Whiplash's armor's chestpiece begins blinking red, as do the ones on all the Hammer Drones. Granted, Tony and Rhodey get out in time but the ensuing explosions destroy most of Flushing Meadows.
Kingsman: The Golden Circle: Merlin, upon stepping on a land mine, lures the henchmen to him with a badass rendition of "Country Road, Take Me Home" before setting it off, taking the henchmen out with him.
Near the end of Kiss the Girls, Casanova attacks Kate in her own house and tries to rape her, but she successfully fights him off. He tears out the gas tubes in her kitchen and grabs a lighter so he can off them both, but Cross arrives on the scene and manages to distract Casanova long enough to kill him safely.
In Kong: Skull Island, Earl Cole pulls the pins off two grenades and tries to goad Ramarak into eating him. It fails because Ramarak notices something is wrong and swats him away with its tail, which kills him and makes the grenades explode far away.
In Lake Placid 3, Reba kills the croc that kills her...with a hunting knife. As if she wasn't Badass enough as it was.
Near the end of Left Behind: World At War, President Gerald Fitzhugh attempts to take down Nicolae Carpathia by having a missile being fired directly toward him while he was meeting Carpathia in his office. Unfortunately, Carpathia survives.
In The Lord of the Rings, the villainous Balrog takes Gandalf down with him. Since Gandalf is one of the good guys, he comes back.
Saruman also threatens a version of this when Gandalf tries to break the wizard's hold on King Théoden: "If I go, Théoden dies." It's a bluff.
In Mad Max: Fury Road, after Furiosa kills Immortan Joe, Nux allows Max, Furiosa, and the Wives to escape in Joe's vehicle while he crashes the Rig to kill Rictus and to prevent more of Immortan Joe's men from pursuing the heroes.
Toward the end of Night of the Demon, Holden catches up with Karswell in a train compartment. Convinced by this point that Karswell has summoned a demon to destroy him in a matter of minutes, he declares that he wants Karswell close by to be sure whatever happens does so to both of them.
Oblivion (2013). Jack Harper (actually his clone) and Malcolm Beech smuggle the nuclear bomb to the Tet, blowing it up and dying in the process. However, their sacrifice saves what is left of humanity.
When the Kaiju decompose on death, they release an agent called "Kaiju Blue" which emits toxic vapors capable of leaving an entire city uninhabitable. This appears to be Alien Blood mixed with an aversion of No Biochemical Barriers instead of a deliberate attack.
With Striker Eureka crippled and the bomb release damaged, Pentecost and Chuck Hansen bait two Kaiju towards them and then detonate their nuke.
While its pilots escape, Gipsy Danger is sacrificed to blow up the rift and the Kaiju's creators.
Predator. One of the key things about the creature is that it has a nuclear bomb in its watch thing, which it activates if it thinks it's near death.
Barely averted in Predator 2. The wounded City Hunter falls off the roof of the slaughterhouse but manages to grab Harrigan's arm, then activates its bomb. However, Harrigan manages to grab the Predator's smart disc, which was conveniently lodged in the wall beside him, and use it to sever the arm of the City Hunter, preventing the bomb from going off.
In Predators, Nikolai takes the pin off a mine while facing a Predator to blow up both of them. While telling it it's an ugly bastard.
Going back to the nuclear bomb, the Predator initiates in AVP: Alien vs. Predator this to destroy their Xenomorph quarry in the event of an unsuccessful hunt.
Leon: The Professional has its title character doing this to Stansfield in the climax: He hands Stansfield a grenade pin. "This is from... Mathilda." BOOM!
In Resident Evil: Extinction, a sniper gets swarmed and bitten by several zombies. He throws himself off the tower and drags all the zombies with him, and they all go splat.
Scanners II: The New Order. After Commander Forrester's plan is definitively foiled, he makes one last attempt to kill David by grabbing one of the police officer's shotguns. David stops him with his powers and nearly kills him in return.
In Shanghai Knights, Chon Wang is clearly outmatched by Lord Rathbone, so he cuts the ropes supporting the platform they are both standing on and sends both of them through the glass face of Big Ben. Chon is caught by Roy O'Bannon, who was knocked through the same glass a little earlier.
Kruge attempts to do this to Kirk in , but "I... have HAD... enough of YOU!"
Kirk himself pulls a variant before this: With Enterprise disabled after a lucky hit knocks out the automation running the ship and leaving her dead in space, he activates the ship's auto-destruct to ensure that the Klingons who board her are killed as well. Kirk and crew beamed down to the surface of Genesis first, and Kruge didn't join the boarding party as Kirk hoped.
In Star Trek Into Darkness, with his crew apparently dead and the Vengeance in no shape to escape or fight, Harrison decides to just ram the thing into Starfleet headquarters. Fortunately for Starfleet, the engine cuts out early and Harrison merely wipes out a small selection of buildings along the coast. Harrison also survived thanks to his enhancements, but Spock knew he would.
Attempted as a last-ditched effort to buy Han Solo some time by Lando Calrissian in Return of the Jedi once the second Death Star is revealed to be "fully armed and operational":
Lando: Yes, I said closer! Move as close as you can, and engage those Star Destroyers at point blank range!
Admiral Ackbar: At that close range we won't last long against those Star Destroyers!
Lando: We'll last longer than we will against that Death Star! And we might just take a few of them with us!
Arvel Crynyd (the doomed A-Wing pilot) in Return of the Jedi. Definitely a Dying Moment of Awesome, since in crashing he kills not only himself but Admiral Piett (the film's fourth-ranked villain, or maybe fifth if you count Jabba the Hutt) and his entire crew, deals a mortal blow to Darth Vader's Super Star Destroyer Executor, and sends the ship crashing into the second Death Star, doubtlessly annihilating more than a few stormtroopers.
It's likely that Darth Vader knew that lifting up Emperor Palpatine and tossing him into a pit would result in himself dying from his suit getting electrocuted, but he didn't care as long as it saves Luke's life.
In Death Star, TIE pilot Vil Dance calls it the WBD — We Both Die.
In the game Rogue Squadron II, you can do the same to the Star Destroyer on Razor Rendezvous; due to a glitch, you don't lose a life from it.
Stealth employed this. The AI plane used this as the Last Act of Sacrifice against a North Korean helicopter. Immediately charged up to hypersonic and boom goes the helicopter. Final words: "Good bye."
In Thor: Ragnarok, Surtur is so dedicated to destroying Asgard he's perfectly willing to use an attack that will destroy himself along with it. The heroes had actually evacuated it beforehand, so he wasn't actually taking anybody but the Big Bad with him, but fortunately he didn't appear to notice.
The final four survivors in John Carpenter's The Thing (1982)realize they have no hope of winning against the alien organism in their camp, and to allow it to retreat as it tries to would mean the end of the world (and presumably every other world it plans to infect). MacReady tells the remaining survivors that none of them are going to make it out of this alive, but "neither is that thing." They decide to blow up their entire camp, ensuring their own deaths in a last-ditch attempt to kill it before it can freeze itself back into the ice until it can infect the incoming rescue team, which would then infect them and everything they come into contact with afterward without anyone's knowledge. After MacReady detonates the cave The Thing is hiding in with a Moment of Awesome "Yeah, fuck you too!" The two survive the blast itself, but as one character says in the final scene as they realize they're no longer in any shape to fight, the fires are going to go out eventually, and so there's no ambiguity that they'll eventually freeze to death long before the rescue team arrives. Finally, because they both realize that it's still possible one of them is infected, they agree that it's for the best that they both die with it, to make sure that it's truly dead.
Richter from the original Total Recall (1990) tries to pull one of these on Quaid. Come to think of it, a taxicab tries to pull it on him, too. Neither works.
In United 93, this comes from both sides. The hijackers are going to kill the passengers on their suicide mission, and the passengers are going to attempt to save themselves while also stopping the terrorists from reaching their final destination. Also counts as a Real Life example since the passengers actually did prevent the al-Qaeda hijackers from reaching Washington D.C. and taking many more lives.
The end of the Wild Wild West movie has Arliss Loveless in a position where he could very well survive along with the hero, but also has the option of pulling this on him, leaving him feeling genuinely conflicted about the issue.
"I'm facing a very difficult problem here. On the one hand, I have an overwhelming love for myself... and on the other, the raw, seething hatred that I have for you. I could kill you very easily, Mr. West, just by pulling on this lever. But I would die along with you, hence my conflict."
West makes the choice for him, pulling the lever and sending both down into a very deep chasm. Only West has the option of grabbing a chain.
In The Wraith, the title character actually allows his own car to be struck and blown up 3 times. He also drives it into the chop shop and blows the place sky-high with it. Packard was also worried that he was trying to do this by firing his shotgun inside the chop shop, mentioning that it was full of volatile chemical fumes. At the end of the movie, Packard tries unsuccessfully to do this to the Wraith.
In The Wrath Of God, one of the "heroes" is mortally wounded but grapples his killer — then brings up one hand holding a grenade. Grinning into the other man's horrified face (at about four inches), he says, "Life is just full of surprises!" before pulling the pin with his teeth and holding the grenade alongside their heads. Boom.