The naming goes back a long way- 1726. It was named after John Montagu, 4th Earl of Sandwich, an 18th-century English aristocrat, although he was neither the inventor nor sustainer of the food. It is said that he ordered his valet to bring him meat tucked between two pieces of bread, and because Montagu also happened to be the Fourth Earl of Sandwich, others began to order "the same as Sandwich!"
The classic answer is that it is named for a habit of the Earl of Sandwich, who when engrossed in games of chance, would not spare time for eating a formal meal, so he would put any meat being served between two slabs of bread and eat that while wagering.
The word sandwich first came from London, when a man named John Montagu when he was to busy gambling even though he was hungry. He told the waiter to get him a piece of roast beef between two pieces of bread, and that was the first sandwich supposedly.