Zhelyazkov announced his resignation in a televised statement minutes before parliament had been due to vote on a no-confidence motion.
The resignation comes shortly before Bulgaria is due to join the euro zone on January 1.
"Our coalition met, we discussed the current situation, the challenges we face and the decisions we must responsibly make," Zhelyazkov said, announcing the government's decision to step down.
"Our desire is to be at the level that society expects," he said.
"Power stems from the voice of the people."
Thousands of Bulgarians had rallied on Wednesday evening in Sofia and dozens of other towns and cities across the Black Sea country, the latest in a series of rolling demonstrations that have underlined public frustration with endemic graft and the failure of successive governments to root it out.
Last week, Zhelyazkov's government withdrew its 2026 budget plan, the first drafted in euros, due to the protests.
Opposition parties and other organisations said they were protesting against plans to hike social security contributions and taxes on dividends to finance higher state spending.
Despite the government's retreat over the budget plan, the protests have continued unabated in a country which has held seven general elections in the past four years - most recently in October 2024 - amid deep political and social divisions.
President Rumen Radev also called on the government earlier this week to resign.
In a message to MPs on his Facebook page on Thursday, Radev said: "Between the voice of the people and the fear of the mafia. Listen to the public squares!"
Radev, who has limited powers under the Bulgarian constitution, will now ask the parties in parliament to try to form a new government and if - as seems likely - they are unable to do so, he will put together an interim administration to run the country until new elections can be held.
The Balkan country of 6.4 million people is due to make the switch from its lev currency to the euro on January 1, to become the eurozone's 21st member.
with AP