This is an important question. The purpose of a union is basically to protect workers by giving them collective bargaining rights. Put it this way, corporations are powerful and they have almost all the power. In view of this power, what can an individual do by himself or herself? The company can just get rid of that person and replace that person with someone who would be willing to do the work. And if the company is amoral, then that company can seek to get the person who would do the work at the cheapest rate, without considering a fair wage. Unfortunately our world works in this fashion in many ways.
In light of this, unions seek to protect workers. If workers join a union, then they come not as individuals, but as a group, which can be very powerful. They are able to negotiate terms, pay, and work conditions. If companies refuse to listen to them, then they could collectively strike. This can cripple a company. Of course, the company at this point could hire new people, but there is strong social pressure to support worker's unions. In short, unions seek to protect workers.
Unions were originally created to protect workers and their rights. These days, unions can do more harm than good in some situations. The purpose of a union is basically to protect the "rights" of an employee and make sure that things such as wages, working hours, and contracts are kept at a fair level. Unions sometimes take advantage of companies; however, and put bad workers in place. Because the unions are powerful enough to bring down companies, go on strike, and basically get their way, companies are forced to abide with their wishes. During online research, I found that there are five principal functions of a union:a service function, a representation function, a regulatory function, a government function, and a public administration function.