Wen spoke at a meeting with deputies from Sichuan province in the southwest as the 12th National People's Congress opened, Xinhua, the official government news agency, reported. A new prime minister is to be selected during the congress.
The prime minister, 70, quoted a Chinese poem, saying that young birds are better singers, to explain why he is giving up the leadership.
"The past decade was extraordinary in the country's development history. I am very grateful and have cherished the chance to serve the country," he said.
Wen said the Chinese people should get the credit for the economic development and improved standard of living of recent years.
"In those years, if I did something good for the people, it would be the result of their trust, understanding and support. All credit should go to the people," he said. "If I did not do enough, it would mean that I was not competent enough. I beg forgiveness from the people."