"There is no long-term prosperity without action on climate change. There is no energy without investing in renewables," he wrote on Twitter.
"That is why I will attend @COP27 next week: to deliver on Glasgow's legacy of building a secure and sustainable future."
The Sunak U-turn was hinted at on Tuesday when his spokesman said the decision was "under review" and after reports that Boris Johnson would attend.
Johnson, who hosted last year's COP26 meeting in Glasgow, on Tuesday night confirmed he would be in Egypt after receiving an invitation from the hosts.
That led many political commentators to conclude Sunak would be forced into going, to avoid being upstaged by his controversial predecessor.
During his tenure, Johnson championed renewable energy as the key to a greener UK economy and its quest for net zero carbon emissions by 2050.
The Green Party's only MP in the UK parliament, Caroline Lucas, called Sunak's announcement a "screeching U-turn".
"But what an embarrassing mis-step on the world stage," she tweeted. "Let this be a lesson to him -- climate leadership matters.
"Now he urgently needs to increase UK ambition on emission reduction targets & pay what we owe to global climate funds," she tweeted.