Yes, it is a statutory duty, not a favor. Article 50 of the Labor Contract Law requires the employer to issue a termination certificate when the employment ends, and to transfer the employee's records and social-insurance within 15 days. If the employer refuses or delays without cause, it may be liable for any resulting loss.
Nationwide (all cities)
An unconditional statutory duty
The duty is unconditional. Article 50(1) of the Labor Contract Law requires the employer to issue the termination certificate at the time the employment ends, and to transfer the employee's records and social-insurance relations within 15 days. This duty cannot be conditioned on settling wage disputes, completing a handover, or any other matter: the employer must not withhold or delay the certificate for any of those reasons.
What the certificate must and must not contain
The content is limited. The Regulations on Implementation (Article 24) specify that the certificate must state the contract term, the termination date, the position, and the years of service. It is not a place for negative comments: the employer must not add unfavorable remarks that obstruct re-employment.
Employer liability for refusal
If the employer refuses or delays without cause and this causes you an actual loss (for example, you lose a job offer because you could not provide the certificate), the employer is liable for that loss. The courts have held employers liable in such cases.