TL;DR
From https://en.wikipedia.org/wiki/Masood_Azhar
Starting 2009, there have been 4 attempts to put Masood Azhar in the UN Security Council's counter-terrorism sanctions list. All the attempts were vetoed by China, citing 'lack of evidence'. China moved to protect Azhar again in October 2016 when it blocked India's appeal to the United Nations to label him as a terrorist. China also blocked US move to get Azhar banned by UN in February 2017. The most recent attempt was on 13th March 2019. However, China pulled the blockade in May 2019, finally resulting listing of Masood Azhar as a global terrorist.
Some extra points
China misused it's position. Ref 1A good analogy is China acted like Saruman when Gandalf showed him the morgul blade.
China had been trying to disintegrate India. Ref 1, 2, 3 Could be still trying! Ref 3-i
India offered refugee to Dalai Lama and Tibetan government-in-exile. They are angry. Ref 4
Just jealous! Two big nations with almost equal population and huge potential.Ref 5
Chinese people were killed in Pakistan. China didn't want to mess with those guys probably. Ref 6, 7
Finally, they had to agree
The speculated reasons are: Ref 8, 9
References
Ref 1:
India hits China wall in anti-terror talks
Not only did China bluntly refuse to re-examine its objection in the UN to proscribing the Jaish-e-Mohammed's Maulana Masood Azhar and two prominent Lashkar-e-Toiba faces, but also firmly rejected looking into details of Chinese arms suppliers provided by Anthony Shimray of the NSCN (IM). [...]
India had hoped for a change in the Chinese attitude if it discussed the matter at a more discreet bilateral setting. [...]
While the Indian side presented detailed information on each of the three terror figures, all Pakistan-based, Chinese officials insisted the information was still insufficient. [...]
Interestingly, the Chinese interlocutors conveyed that Beijing was not contesting the terror-related evidence provided by Delhi, but that information connecting the three to al-Qaeda or Taliban was not enough.[...]
The Chinese side argued that this was a technical requirement under the relevant UN resolutions. A frustrated Indian delegation then promised to revert with more information in due course. Since then, instructions have gone out to security agencies to obtain evidence of the kind sought by China.[...]
If this marked a poor beginning to the talks, sources said, the discussion on Northeast insurgent groups and their alleged Chinese links was almost a non-starter. The Indian side passed on information provided by Shimray in his statements before the court that the NSCN (IM) had arranged arms and ammunition worth nearly $2 million from TCL, a subsidiary of Chinese arms company China Xinshidai. However, even names of individuals, the agents in Bangkok and other such details did not seem to impress the Chinese side.
Ref 2:
In July 2009, Zhan Lue, wrote an article for the China International Institute for Strategic Studies (CIISS). It puts forth a shockingly offensive proposition that ‘China should break India into 20-30 independent states’ with the help of “friendly countries” such as Pakistan, Bangladesh, Nepal and Bhutan.
Chansoria, Monika. India-China: Assessing the Need to Strengthen Bilateral Confidence-Building Measures. No. SAND2012-8471C. Sandia National Lab.(SNL-NM), Albuquerque, NM (United States), 2012.
Ref 3:
Chinese policy towards India is “no holds barred”: safeguarding Azhar Masood of the JeM from being labelled a terrorist, objecting to the Asian Development Bank (ADB) loan to Arunachal, flooding fake currency into India courtesy Pakistan, supplying small arms to insurgent groups in India, permitting insurgent camps in Chinese territory, etc
Katoch, P. C. "China: A Threat or Challenge." Claws Journal (2010): 79.
Ref 3-i:
China's weapon supply to Myanmar terrorists re-ignites NE insurgency fears
The recent seizure of a large quantity of illegal Chinese weapons in Mae Tao region, which is on the Thai side of the Myanmar-Thailand border, has given rise to India's fear of "another attempt to reignite insurgency in its Northeast region", a Europe-based think-tank said. [...]
"It has also reignited the serious questions that had existed for long about the scope and depth of China's support to terrorist groups in the region in pursuit of its policy of what a Thailand-based organisation termed 'diplo-terrorism'." [...]
"They are not the weapons currently used by the AA (Arakan Army). The weapons manufactured by the Wa (United Wa State Army) and the KIA (Kachin Independence Army) are not up to much. They cannot fire on automatic. The seized weapons are original and Chinese-made." [...]
"Indian insurgents from the country's Northeastern states who have been sheltering for years in Myanmar, as well as the AA that has its roots in the Rakhine state of Myanmar, both present security challenges for India. [...] "
Ref 4:
There had been an invitation from the Dalai Lama to Nehru, forwarded by Zhou Enlai in January 1958 to visit Tibet, but the Chinese began dragging their feet over Nehru's visit. Incidents of infiltration by Chinese troops in territory claimed by India began to take place more frequently, and China started publishing maps that claimed large sections of the NEFA. [...]
In the face of widespread public sympathy and support for the Dalai Lama, the Indian government had no option but to give asylum to the Dalai Lama. This was regarded by China as a grave act of provocation. [...]
As relations between India and China deteriorated in the months and years that followed Zhou's failed visit to India in April 1960, and especially after the India-China border conflict of 1962, India's support to the Dalai Lama and the Tibetans in exile underwent a dramatic change. The Tibetans were allowed to set up a so-called government-in-exile in Dharamsala, even though India has never acknowledged this. Over the last five decades, considerable assistance has been given by India to the Tibetan community in exile, including allocation of land for the rehabilitation of the refugees and funding for schools and Tibetan cultural establishments. [...]
Contradicting the official Chinese line, India's official statement of 15 March 2008 pointedly talked of "innocent people" having died in Lhasa. The statement drew attention to Tibet's autonomy, suggested that there was merit in the demands of the Tibetans and went on to imply that it was for Beijing to find a solution through talks, not use of force.
Sikri, Rajiv. "The Tibet Factor in India-China Relations." Journal of International Affairs (2011): 55-71.
Yet it was an altogether separate visit to Arunachal Pradesh a year later by the Dalai that truly provoked China's ire. The Dalai Lama, who permanently resides in Dharamsala, India had publicly announced plans to visit AP in 2008.
Cold Peace: China–India Rivalry in the Twenty-First Century By Jeff M. Smith
Ref 5:
According to the extant literature, China’s unwillingness to designate Masood Azhar as a terrorist under the UNSC 1267 Committee rules is explained by inter-state or great power rivalry. The narrative states that India-China ‘protracted rivalry’ and India-Pakistan ‘enduring’ and ‘intractable rivalry’ has resulted in a strategic and “all weather partnership” between Pakistan and China against their common enemy India. According to this narrative, the fundamental rationale for India-China rivalry is the pursuit for great power status by the two countries—based on the belief that their countries are destined to play a major role in world affairs influenced by their great civilizational and historical past.
Verma, Raj. "China’s new security concept: India, terrorism, China’s geostrategic interests and domestic stability in Pakistan." The Pacific Review (2019): 1-31.
Ref 6:
Chinese citizens have been frequently kidnapped and killed in Pakistan and it has developed a reputation for being one of the most dangerous countries for overseas Chinese. Insecurity has delayed various Chinese projects (even those with huge investments), and in some instances China has also threatened to pull each and every worker out of Pakistan if the security for Chinese citizens is not improved. This has posed a serious risk to the whole economic relationship. The targeting and killing of Chinese nationals in Pakistan have increased significantly since 2003. There are concerns that more Chinese citizens will be targeted by different groups which poses a serious risk to CPEC, BRI, NASC and China Dream. [...]
If militants/terrorists and religious groups oppose CPEC, it cannot work. Pakistan is trying its best but we do not think Pakistan has the capacity and capability to reign in the terrorists. China wants peace with terrorists and religious groups. China needs their support. Attacks will delay or completely derail CPEC.
Verma, Raj. "China’s new security concept: India, terrorism, China’s geostrategic interests and domestic stability in Pakistan." The Pacific Review (2019): 1-31.
Ref 7:
Don't buckle under pressure: Masood Azhar warns Pakistan govt of acting against him
Wanted terrorist and the chief of UN designated terrorist organisation Maulana Masood Azhar on Thursday warned the Imran Khan government against buckling under Indian pressure and taking action against him in the aftermath of the Pulwama terror attack.
Ref 8:
Why China agreed to list Masood Azhar as a global terrorist now
While there are several reasons for the u-turn by China now, two seem key: post-Wuhan summit between Prime Minister Narendra Modi and President Xi Jinping, India China relations have improved and India’s persistence on Azhar has paid off, and two, combined efforts of the US, the UK and France to push China to change its mind, even threatening to shame it with a public vote at the UNSC.
Ref 9:
How Masood Azhar was finally blacklisted by UNSC
there were major diplomatic activities across countries and missions. India reached out to every member on the security council individually, and through multilateral platforms, presented them with the proof it had of Azhar's hand in masterminding terror attacks in India, which included Pulwama and Pathankot. [...]
India worked on China untiringly. [...]
India's China strategy was two-pronged. It knew that China was too powerful a nation to be diplomatically isolated, but it could be made to "stick out like a sore thumb" in its defence of Pakistan if India was able to build up a rock solid case against Azhar and present it to every stakeholder, say sources. The other was to continue relations with China in the new Spirit of Wuhan, and guided by the Astana Consensus, not letting differences become disputes.
Both countries know how counter-productive conflict can be at this stage of global dynamics. And, two strong economies talk the language of money. Even at the heights of Doklam, there was barely a dent in the economic ties. [...]
The 2017 motion against Azhar too had been moved by the Permanent Three – UK, France and the US—but this time, they decided put more heft behind the motion. [...]
France, while banning Azhar nationally, also moved a proposal for the same in the European Union. [...]
The US, not one for subtleties, expedited matters when it announced it would take the matter of Azhar's listing to the UNSC directly, bypassing the sanctions committee.