Buddha himself came up with the five precepts as a way to help his students that weren't monks to live a life that is peaceful and full of happiness.
The actions that are avoided by keeping the five precepts are actions that can lead to suffering. So, the precepts are a way of protecting yourself and others from that suffering.