Establish game rules and behavior first

A players behavior at the table is based on expectations and rules that need to be agreed upon before the game even starts. I am a huge advocate of stopping people from acting rude or disrespectful.
During session zero, everyone in the game needs to agree on what the play style is and how evil the party wants to be. Alignments should be followed according to character. If a player wants to be evil in a party full of good people, the players need to have a really good reason for it. Good characters won't travel with known criminals or evil people. And that needs to be role played.
Give your attention to other players

If another player is always interrupting or trying to hog all of the attention your other players will never get their turn. This selfish player is probably trying to do everything without giving other players a chance. This is easy to control by simply giving the attention to another player. Interrupt the rude player if you have to.
"We know what you are about to do, now lets take turns and see what our paladin would like to do." As the DM you need to take your attention away from that player.
Players can help too

Your character can interrupt the selfish player too. The DM will probably appreciate your help.
Talk in character, "If you attack the king, you won't be my traveling companion anymore. Your actions prove to be unbecoming and insulting. You will get no further support from me. If I (my characters) can't trust you, I can't help you." Hopefully the offending player will understand that he needs to act according to the rest of the group.
You can also say something like this
"In order to finish our quest, we need everyone working together for the common cause. If you want to kill kings and burn down taverns, you should look for another group to travel with."
Hopefully the player will get the obvious hint.
A player can also help intervene on behalf of the story. When a bad player makes the bad decision to kill an NPC. Your character can and should hold them back. In a one shot game it isn't as important. But an ongoing campaign will most likely have dire consequences. Stay in the way of the bad player until the DM can intervene and stop the conflict.
Stop the murder hobo in Their tracks

Stop a rude boy in their tracks. This trick also works to stop players from destroying your game.
Rude Boy: "I slap the bartender in the face, then I light the tavern on fire, then I kill the closest guard next to me."
Dungeon Master: (taking the wind out of rude boys sails.) "Before you get close to the bartender, I want to know what everyone else is doing. Lets take turns and go around the table."
Take turns and let all the other players go first. Usually that can de-escalate a game destroying rude boy. Since the narrative was changed by another player, the rude boy should be focused on something else beside killing. If it gets back to his turn and he still wants to be destructive, let him give it a try. Since we already know that the rude boy wants to attack the bartender first, we can have a little time to prepare while the other players are going.
The key word here is 'Before'. Don't let a rude boy get away with even getting close to what they want to do. Don't even acknowledge what rude boy is saying. The word 'before' can be used in any situation to take control of the action and slow down a player.
"Before you get to the bartender, roll a dexterity save, (make the DC impossible to beat) you have been hit in the leg with an arrow, you will now be moving at half speed." or something like this.
"Before you move to attack the bartender, you realize that the bar is full of royal guards and other witnesses who probably want to enjoy their dinner."
"Before you attack the king, the two guards closest to you grab the crossbow out of your hands. "
Enlist the players for help

This is another diversion tactic, but a little more involved. Talk to the other players. "You see your rude companion about to attack the bartender, what are you going to do." Say this to every player before their turn. Let all the other players go first and hopefully they will help stop or otherwise slow down the attacking player.
Dealing with a party of murderers

If your whole party is a group of murder hobos, it might be hard to ask for help from other players. So get more NPCs involved. Bring in guides or advisors who can speak for you as the DM. Warn the players of the consequences.
"I really don't think you would want the entire kingdoms army on your tail, if you do try to kill the king."
"If you allow this fire to burn down the entire forest, it will be your heads that the wrath of the gods come down upon!" Let your party of hobos reap what they sow.
If the party wants to act like villains, every NPC in your world will treat them like villains.
Bring alignments into play and make the players suffer every time they don't act accordingly. Make them ask their gods for forgivenss in order to get their magic back. Have the thieves guild set up rules of conduct or the players won't get to be a member. Rouges might steal, but do they draw the line at murder?
Players need to deal with consequenses

If the player still insists after a warning. Say this. "You hit the bartender in the face and suddenly you feel the point of a sword in your back. One of the guards has hit you for 900 damage. (Don't even roll for attack or damage at this point. Do enough damage to teach a lesson.)You are now unconscious and are currently being dragged toward the prisons. Now what do the other players want to do?"
Consequences are only limited by your imagination.
Players killed a bartender or burnt down a town? Now there is a price on their heads. High level NPCs will always be hunting them down. Rogue NPCs will turn them in for a reward at any moment.
The PCs are never the strongest people in your world. If they just keep surviving, throw something stronger at them. Make them learn their lessons the hard way. There is always a bigger fish. There will always be something or someone stronger than your PCs. Bring the gods down if you have to. Have celestials and archons hunt the players down. You have my permission to make your murder hobos life a living hell.
Even more consequenses

The murder hobos faces are plastered on wanted posters everywhere. Every NPC knows what the players look like. Guards won't let your party into town. Shopkeepers and taverns refuse to serve the criminal party. "You burnt down my grannys hometown! There's no way I will let you into our city!"
If the party has a reputation for evil, cultists, murderers, and other criminals might want to join forces with the party. "We know you killed the royal guards in the city, maybe you can help us destroy them all! Take down their peacekeeping ways!" or, "Clearly you don't have any qualms about preserving life, so maybe you can help us summon our great god of death"
At this point the players should be questioning their morality, if not, the campaign just turned into a villains story. An evil party. All the good guys will be constantly hunting them down.
Thank You!
Here at gamesmastery.com we want to give our appreciation and support to gamers everywhere. Our mission is to inspire creativity and help everyone enjoy the best life possible.
If you are interested in learning all that you can about being a great Dungeon Master take a look at the DM's Aresenal.
Disclosure: I am an affiliate of Bookshop.org and I will earn a commission if you click through and make a purchase with no extra cost to you.