I'm going to try to condense two thousand years of history into a few paragraphs:
Ürümqi, the capital of Xinjiang, was founded by the Tang dynasty, at the time, possibly the most advanced civilization that had ever existed, which was predominantly Han. It's founding was motivated by its proximity to the Northern Silk Road.
At the time of its founding, the Han were not indigenous to the region. It was populated by a variety of ethnic groups, including the Dzungar, Tibetans, Hui, and the Uyghur, but over the many years that have passed since, it has accommodated many waves of Han migration. Even so, up until about twenty years ago, the region operated with a considerable degree of autonomy, evidenced by it's present day formal name, the "Xinjiang Uygur Autonomous Region". If you like, it was a early success of multi-culturalism, but it was decidedly subservient as a tribute state to the central Han/Manchu/Mongol "Chinese" dynasties of the day. Autonomy was tolerated, but only up to a point.
The "annexation" of Tibet in 1949, was the beginning of the end for that autonomy. Mao declared an intention to liberate the Tibetans from their supposed "theocratic feudal system". In reality this was mainly a response to fear of invasion by the West and neighboring countries. To properly understand this, you need to appreciate that the visceral insecurity of the Han people, bordering on paranoia, to being invaded by the bordering "barbarian" tribes had been a central feature of their culture for at least two millennia and was more than justified.
In recent years, the growing strength of the Chinese nation has given them the confidence to solve their border issues once and for all. In 2009 the local Uyghur people revolted against their Han neighbours, and in subsequent years committed acts of terrorism against the Han. The C.C.P. had had enough and began a crackdown. Fueled by Xi Jinping's personal distrust of other religions and cultures, and a long-running resentment by the general public for their (largely imagined) criminality, and for receiving favorable treatment under the one child policy, it wasn't hard to convince the masses that they were undesireables, a threat, and needed to be dealt with harshly.
The C.C.P. have evolved recently to become even less tolerant of dissent. Xinjiang had to be "standardized", and the only approach known to work (in Tibet) was utter assimilation. Xinjiang also has significant energy resources (particularly coal), and is hugely important to the Belt and Road Programme (the modern-day equivalent to the Silk Road). Other factors are also relevant, but these are probably the main ones.