Yes, PM Modi was denied visa in 2005. According to an archived post of United States Department of State, Mr. Modi this visa under section 214 (b) of the Immigration and Nationality Act because he was not coming for a purpose that qualified for a diplomatic visa.
Not only that his existing tourist/business visa was also revoked under section 212 (a) (2) (g) of the Immigration and Nationality Act.
Section 212 (a) (2) (g) makes any foreign government official who "was responsible for or directly carried out, at any time, particularly severe violations of religious freedom" ineligible for a visa to the United States.
The decision was based on the fact that, as head of the State government in Gujarat between February 2002 and May 2002, he was responsible for the performance of state institutions at that time. The State Department's detailed views on this matter are included in its annual Country Reports on Human Rights Practices and the International Religious Freedom Report. Both reports document the violence in Gujarat from February 2002 to May 2002 and cite the Indian National Human Rights Commission report, which states there was "a comprehensive failure on the part of the state government to control the persistent violation of rights of life, liberty, equality, and dignity of the people of the state."