There are many theories. The best are explained at: http://www.wired.com/2015/02/whats-up-w ... and-boxes/Professional Tourist wrote:What is it about curling up inside a box that cats like so much? Does any human know?
I believe a combination of these three provide the best explanation.