The Chinese social security law is decreed by the government, but its implementation and its specific details are the responsibility of local authorities. Employee and employer contribution base and rates are specific to each local jurisdiction and are subject to annual changes and reforms. The contribution of employees and companies are mandatory no matter if they are Chinese or foreign.
The Chinese social security system is based on 5 mandatory insurances (pension fund, medical insurance, unemployment insurance, industrial injury insurance and maternity insurance) and a housing fund (only applicable to Chinese employees).
Pension: to receive a pension in China 15 years of contributions are mandatory in general. The retirement ages for men and women depends on the sectors (blue-collar work -> 1st and 2nd sector, white-collar work -> 3rd sector). Usually blue-collar workers retire before the white-collar workers.
Medical Insurance: If an employee is ill or needs an operation, he can have a part of the medical costs covered by the medical insurance. The treatments costs will only be accepted if they take place in, or are managed by, hospitals and clinics approved by the Chinese government.
Unemployment Insurance: An employee must contribute to the unemployment insurance fund for at least 1 year so that in case he become unemployed, he has the right to receive the contributions for no longer than 2 years.
Work-related injury Insurance: This insurance covers the accidents directly related to work and only employers need to contribute.
Maternity Insurance: this insurance is only supported by the employers for the female workers (in some cases for the male workers too). In order to benefit from this insurance, the employer of the female worker must pay at least 3 months to this fund and the medical services have to match with the Chinese Family Planning Policy.
[1] https://www.hrone.com/guide-chinas-social-security-system-pays/