BEIJING—After months of uncertainty for foreign nonprofits, China released a list of activities the groups will be allowed to pursue under a controversial new law, with a surprising number of activities falling in potentially sensitive areas such as legal services.

Chinese President Xi Jinping has waged a fierce campaign against foreign influences in the country, and the law is widely seen targeting groups working in areas such as human rights and rule of law.

Groups...