A 401(k) is a type of qualified retirement plan created by employers, where an employee deposits money into a retirement fund and the employer matches a certain percentage of the employee's contributions. A 401(k) provides a payout at retirement that is reliant upon the total money contributed and the performance of the investment.
Most employers match employee contributions to 401(k) plans in order to attract and retain talent at their company. Most employees are very anxious about saving for retirement. Usually, if an employee has offers from different companies and all else are equal, 401(k) contribution matching could become a factor in choosing an employer.
Many employers prefer defined contribution plans instead of defined benefit plans because the former doesn't require them to decide where to invest and doesn't specify a certain amount of money to give when an employee retires. Defined contribution plans like 401(k) matching puts the onus of investing on the employee and doesn't guarantee a set payout at the end, which ultimately is more cost effective for the employer.
This question was answered by Chizoba Morah.
Interesting question. At the "human" level, companies that offer a match on the 401k plan are more likely to have success hiring people compared to similar companies that don't have offer a match. Also, among employees, it likely creates some degree of loyalty to the company.