system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5 what is a 401(k)

I just read a post here in Reddit about 401k, but I'm not getting the concept. 
Can someone please explain what it is and why would a company be willing to match? What does the company you work in win by matching it?

Edit: Thank you for all the answers! the were mostly very clear and now I understad why companies and people do it. 
Edit 2: I´m glad to know I wasn´t the only one who doesn´t got it!
gpt
Back in the day, companies would give employees a pension, where after retirement the company would keep paying a portion of their salary. The problem was that the company had to invest and earn money to pay those obligations, and sometimes they couldn't. 

The 401(k) gives companies the ability to put money toward employees' retirement, but put the responsibility for investing on the employees. If they don't enroll, or don't contribute to get the maximum match, it's not the company's problem. The match serves as a benefit to attract better quality employees.