The main reason for killing him were political accusations with the green light from Sufism, Sunni & Shia scholars. The Sufism whom Hallaj followed, had excluded him from themselves, and also Sunnis and Shias. He had his own sect and followers.
He was arrested times and released but at last with two of his hand writing the minister of a basic caliphate could prove his heresy. In one of those handwritings, he started the letter with this statement "من الرحمن الرحیم" and in other one, affirmed that who cannot go to Haj, can do it in his house.
After about one century from his death, some Sufism scholars defended his works, and at last he was called the martyr of God way.
As he has many oppositions and fans during history, the judgment about him is not right. But what clear is, that he was not a true man from the viewpoint of Shia Ulamas who were living in those days. The persons like, ابوالحسن علی بن حسین بابویه & حسین بن روح نوبختی
P.S.: For translating Arabic to English, the first phrase has explanation:
At the start of any surah we say "Bism-i-llahe-rahmani-rahim". Which the translation is "In the name of Allah, the Beneficent, and the Merciful". Please mention that these two words "The beneficent الرحمن" and "The merciful الرحیم" are two name of Allah. The Hallaj, started his letters to his follower with this statement, "FROM THE BENEFICENT, THE MERCIFUL". Which shows he believed in Reincarnate of Allah in his body.(It is said that he brought up this kind of thinking from Indian sects when he was in India for learning magic). As you know he was shouted out the word اناالحق (Ana-l-haq) and as the word Haq is one of Allah's names, He showed up the reincarnation of god in him.
For the persons I named them in Arabic, Their names in English are:
Abul Hassan Ali bin Babvey and Hussain bin Rouh No Bakhti. Please mention that Hussain bin Rouh was the deputy of Imam Zamn (A.S) in those days. And he was the most honest and legitimate person.