Anthony Hopkins hasn't ever played the historical figure Gandhi in a major motion picture as of 2022. He was offered the role of Gandhi for the 1982 film "Gandhi". He wasn't able to take the role because of time conflicts.

This film is a period biographical film and was based on the life of Mahatma Gandhi, the leader of nonviolent non-cooperative Indian independence movement against the British Raj during the 20th century. A co-production between India and UK, it was directed and produced by Richard Attenborough from a screenplay written by John Briley. Ben Kingsley stars in the title role.

Mahatma Gandhi (Mohandas Karamchand Gandhi, born October 2, 1869 in Porbandar, India—died January 30, 1948, Delhi) was an Indian lawyer, politician, social activist, and writer who became the leader of the nationalist movement against the British rule of India. Because of his beliefs, words, and actions, he is considered the father of his country. He became internationally esteemed for his doctrine of nonviolent protest (satyagraha) to achieve political and social progress. As an anti-colonial nationalist and political ethicist, he employed nonviolent resistance to lead a successful campaign for India's independence from British rule, and to later inspire movements for civil rights and freedom across the world.

Hopkins starred respectively as Adolf Hitler, John Quincy Adams, and Alfred Hitchcock in "The Bunker"(1981), "Amistad" (1997), and "Hitchcock" (2012).

More Info: en.wikipedia.org