Before the Neolithic revolution, people would hunt and gather food; mostly working for themselves only.
After this, people turned to agriculture. By working together during agriculture, they could share their tasks and specialise (some people tending to food, some defending it) which lead to more food being produced and retained by the group (not stolen by others for example).