BEIJING—China pledged billions of dollars in new aid to Africa and said Chinese companies doing business there would act responsibly, as the country seeks smooth relations with the resource-rich continent despite emerging trade and social tensions.

China will offer $20 billion in loans to African countries to develop infrastructure, agriculture, manufacturing and small and midsize enterprises, Chinese President Hu Jintao said Thursday during a gathering of African leaders in Beijing....