He was. He was a bitter racist, and he later admitted it. A change came about when he went to Mecca, and saw people of all colors mingling and worshiping as one.
At that point, he broke with Elija Muhammed, and abandoned racism. He spoke out about this, and speaking against it is the reason he was murdered.
While in prison, Malcolm X became a member of the Nation of Islam, and after his parole in 1952, quickly rose to become one of the organization's most influential leaders, serving as the public face of the controversial group for a dozen years. In his autobiography, Malcolm X wrote proudly of some of the social achievements the Nation made while he was a member, particularly its free-of-cost drug rehabilitation program. In keeping with the Nation's teachings, he promoted black supremacy, advocated the separation of black and white Americans, and rejected the civil rights movement for their emphasis on integration.
By March 1964, Malcolm X had grown disillusioned with the Nation of Islam and its leader Elijah Muhammad. Expressing many regrets about his time with them, which he had come to regard as largely wasted, he embraced Sunni Islam. After a period of travel in Africa and the Middle East which included completing the Hajj, he repudiated the Nation of Islam, disavowed racism and founded Muslim Mosque, Inc. and the Organization of Afro-American Unity. He continued to emphasize Pan-Africanism, black self-determination, and black self-defense.
In February 1965 he was assassinated by three Nation of Islam members. The Autobiography of Malcolm X, published shortly after his death, is considered one of the most influential nonfiction books of the 20th century.
https://en.wikipedia.org/wiki/Malcolm_X
A formerly self-professed racist, Malcom X had a change of heart and died fighting against racism.