Short anwser: to regain hp, used spell slots and abilities and to prevent your character from dying due to exhaustion. Also some of the story elements betwern character interactions happen at camp.

Long anwser: in dnd you have 2 types of rests. A long rest (basicly sleeping.) Which takes up 8 hours or 4 if you are an elf and short rests. Where your group just hangs around and relaxes for an hour.

Some abilities regain on a short rest like a warlocks spell slots (mind you he also has less spell slots then other classes) while others require a long rest.

If you dont sleep you build up fatigue which eventually results in death so not resting is not really an option.

Often times on pnp DND alot of character interactions (players roleplaying) happen when the party stops to camp for a bit. Ofcourse it can differ from group to group but what Larian put in the game closely resembles how groups that ive played with roleplay character inter party interactuons.