The Khazars were a Turkic settled people who had an empire around the Caspian sea. They somehow disappeared from history pages after the 10th century AD. In some sources they're called "Hazar" and their region 'Hazaria, or Hazarstan'.
The Hazaras on other hand are a persianized Turkic ethnic group native to Hazarstan region in central Afghanistan. They're pretty distinct from the neighboring ethnicities in terms of culture, language and appearance. There are no sources with any mention of the word 'Hazara' in Afghanistan prior to the 15th century.
Is this a pure historical coincidence that these groups of people's have so similar names, or could there be some connection?
The thing with the Hazara people is that a lot of information about them has always been wrong or pure propaganda due to fascism/racism.
Like if we speak about their genetics/DNA, many people used to say they're Mongolian. But more and more experts are saying that they are a mix of Turkic, Iranic as well as Mongolian. (Turkic not Turkish. Iranic and not Iranian.) And that most Hazara people's genetics/DNA consists of mainly Turkic, like for example +60% and +30% Iranic. That there are only a minority of Hazara people in the whole world that actually have Mongolian genetics/DNA and even in this minority group, the Mongolian genetics in them are not more than 5%.
So the Hazaras are a Turkic people more than they are an Iranic people.
Iranic is Persian. Like people from Iran and Tajikistan are Iranic/Persian.
Turkic people are people from Turkey, Uzbekistan, Turkmenistan, Kyrgyzstan, Azerbaijan, and Kazakhstan as well as the Uyghur people in China.
What is really interesting about the Hazaras is that they are a Turkic group of people but their language isn't Turkic. The Hazaras language is Hazaragi Persian. The Hazaras speak Persian with their own Hazara accent. Hazaragi Persian, Iranian Persian, Tajikistani Persian, and Afghanistan Persian (known as Dari) are all mutually understandable because they all speak the same language only with different accents.
The Hazara's culture is Persian (Iranic) and not so much Turkic even though they have some aspects or traditions that are Turkic their culture I mainly Persian.
The Hazaras are mostly Shia Muslims like the people of Iran. But their fellow countrymen in Afghanistan are mostly Sunni Muslims. Their fellow Turkic groups of people are Sunni (except for Azerbaijan which is mostly Shia).
The Hazaras are a Turkic people that isn't Sunni Muslim and that don't speak a Turkic language or have a Turkic culture.
The Hazaras speak Persian and are Shia Muslims that have a Persian culture but they aren't an Iranic (Persian) group of people. Or they have little percentage of Iranic/Persian genetics/DNA and mostly Turkic genetics/DNA.
The Hazaras have been killed way before the existence of the Taliban in Afghanistan. They have been killed for almost 3 centuries now by afghans (Pashtuns). They have been killed because of their religion due to them not being Sunni like the rest of the inhabitants of Afghanistan. They have been killed due to their ethnicity because they aren't afghan (Pashtun), Tajik, Uzbek or Turkmen but because they are Hazara. They have been killed due to propaganda like "The Hazara are foreigners who don't belong in Afghanistan" when in reality they have lived there just as long as the Tajiks, Uzbeks, and Turkmen.
The afghans (Pashtuns) have only lived in Afghanistan for a maximum of 350 years and have changed the name of the country from Khorasan to Afghanistan. The afghans have changed the name of the language from Persian to Dari. The afghans have changed the name of their own ethnicity from afghan to Pashtun just so that everyone in the country can be called afghan. Basically, they have tried to make the afghan ethnicity into the country's nationality but they have failed because most Hazaras, Tajiks, Uzbeks, and Turkmen from Afghanistan refuse to call themselves afghans. Afghans = Pashtun. +95% of the terrorist groups known as the Taliban consist of afghans (Pashtuns) and not of Hazaras, Tajiks, Uzbeks, Turkmen, or any other ethnicities.
More and more Hazaras, Tajiks, Uzbeks, and Turkmen as well as all the other non-afghans (non-Pashtuns) are starting to realize that afghans (Pashtuns) have been ruling the country for almost 3 centuries with the help of the British, Americans, Russians and Pakistan. That in actuality only 10-15% of Afghanistan consists of afghans (Pashtuns) and the rest of the country meaning 85-90% of the country is Tajik, Hazara, Uzbek, and Turkmen. That the Tajik, Hazara, Uzbek, and Turkmen are the actual ones who should be in power and they are the rightful owners of this country, not afghans (Pashtuns).
More and more people understand that the history of the Hazara people has been erased or changed into some wrongful propaganda.
So in conclusion, yes there are some historians that see a connection between the Khazars and Hazaras due to them both being Turkic people. But there are a lot of things to have in consideration when we speak of Hazaras because they aren't the typical Turkic group of people nor the typical Iranic (Persian) group of people. I hope you didn't get too confused reading all of this.