Because they are fun. That is the whole answer, and it is not a shallow one.
Fun is doing real work, though. Games offer goals you can actually finish, difficulty you can feel yourself improving against, and a space where failure costs nothing. Add the social side — playing alongside friends, or against people you will never meet — and you have most of the motivation covered without needing anything more complicated.