To a cat its litter tray is a source of security. You can equate it to the security a child gets from sucking its thumb or cuddling its favourite comfort blanket. When your cat is therefore upset or stressed it may choose to take up residence in its litter tray.