What did shah did so that muslims in Iran were opposed to him?

As concerns the specific reasons for the Iranian protests and the eventual revolution, they were numerous:

Wealth & Employment Issues:
Most importantly was the wealth inequality between the Shah and the nobility and common Iranian citizen. There was immense poverty throughout the country and high unemployment, underemployment, low wages, and few protections for laborers.

Religious Conservatism: Most Iranians were religiously conservative (similar to the American Bible-belt as opposed to the Fundamentalists) and resisted the Shah's Westernization and Secularization movements in Iran. The Shah made clear that religion was not important to him as a ruler, whereas it was a concern among the people.

Puppet to Foreigners: The Shah was also seen as a Western puppet, especially when the CIA overthrew the Iranian President Mossadegh in 1953 to re-install the Shah of Iran and considering how Iran profited very little from its own petroleum.

Brutal Secret Police: The Shah had a notorious secret police called the SAVAK which harassed people and killed scores of others.

Authoritarianism: Iranians wanted to be in control of their own affairs. Iranians wanted some form of self-government or democracy. The Shah was an authoritarian who prevented people from expressing their own opinions.

Issue for Fundamentalists: Particularly in the fundamentalist camp, the fundamentalists in Iran felt that the Shah epitomized a Western culture of greed and materialism, because he tried to establish a more secular government. As with many rulers, he accumulated vast personal wealth. He also employed various means to suppress political dissent. It was ultimately the exiled Ayatollah Khomeini who in 1979 succeeded the Shah and established an Islamic religious government.

Note: The fact that these grievances existed does not mean that the Islamic Republic of Iran afterwards "fixed" these problems.

Answer 2
The main reason was that majority of Iranians are Shia Muslims and wanted a real Islamic government of jurist and Shah was in fact an anti-Islam dictator.