The historical mystery or historical 'whodunit' is a subgenre of two literary genres: historical novels and mystery fiction. These works are set in a time period considered historical from the author's perspective, and the central plot involves the solving of a mystery or crime - usually murder.
Though works combining these genres have existed since at least the early 20th century, many credit Ellis Peters's Cadfael "Chronicles" (1977–1994) for popularizing what would become known as the historical mystery (Wikipedia).
Perhaps the first modern English work that can be classified as both historical fiction and a mystery however is the 1911 Melville Davisson Post story "The Angel of the Lord", which features amateur detective Uncle Abner in pre-American Civil War West Virginia. Agatha Christie published "Death Comes as the End", a mystery novel set in ancient Egypt. In 1950, John Dickson Carr published a historical mystery novel called "The Bride of Newgate", set at the close of the Napoleonic Wars.
Some authors have published historical fiction with remarkably accurate historical background, but filled with social tension, intrigue, political conflicts and murder. For instance, Ken Follett's sensational historical fiction "The Pillars of the Earth" (1989), is a novel about building a cathedral in a small English village during the Anarchy in the 12th century. More on Wikipedia