Because the litter box is dirty - from the cat's viewpoint, not yours. Cats often react to any type of stress by suddenly urinating or defecating outside the litter box. The stress may be caused by a new cat in the neighborhood; children home on vacation; too many cats in the house; your going away on vacation or a new piece of furniture. Urinary tract problems also cause cats to urinate in places other than the litter box. Any sudden change in elimination habits should be discussed with your veterinarian.
Until your cat is reliably house trained, she should not have free run of your home. If your cat continually makes mistakes, the behavior can simply become a habit. Punishing a cat after the fact teaches her to be afraid of you. Scolding and then taking the cat to her litter box after she has already eliminated teaches her to associate the litter box with punishment. Basically, punishment doesn't work with cats: prevention and praise for getting it right are the keys to training.
When you leave the house for any length of time, your cat should be confined to a single room, preferably one with non-porous floors, such as a kitchen, bathroom, utility room, basement or garage. Provide your cat with a bowl of water and a warm place to sleep at one end of the room and a freshly cleaned litter box at the other end. Until the house soiling has been cured, your cat should have a regular feeding schedule so she will develop a corresponding elimination schedule.
Your cat does not simply need a litter box - she needs a clean litter box with fresh litter. Your cat will be inhibited from using her litter box if it smells of urine. Think about it from the cat's viewpoint. When she soils your dining room carpet, the area is immediately and thoroughly cleaned. Given the choice between a regularly cleaned place and a litter box that gets changed only once or twice a week, your cat will naturally prefer the carpet. The litter box must be cleaned daily. The old litter must be discarded and replaced with about 1 1/2 inches of fresh litter. Rinse the litter box thoroughly with water. Adding a little vinegar or lemon juice to the water will help neutralize the odor of the cat's urine. Do not use ammonia; this will make the litter box smell worse.
Make sure that the litter box is in an appropriate place. Cats do not like to soil the areas close to their sleeping or eating areas, so place the litter box some distance away. However, do not place the litter box in an area that is too inaccessible. For example, if the litter box is placed in the bathroom, make sure the door cannot swing shut preventing the cat from getting to it. If the cat is new to your home, she may go into hiding for a few days so place a litter box close to her hiding place.
Some additional factor may be inhibiting your cat from using her litter box, so put down an extra one in a different location. If there is more than one cat in the house, have several litter boxes available.
In order to reward your cat for eliminating in her litter box, you must be there at the time she eliminates. You need to have some idea of when your cat urinates and defecates. Most cats, especially kittens, will eliminate shortly after waking; after eating; and after exercise.
To help you predict when your cat will eliminate, feed her at regular times. If the input is on a regular schedule, the output will follow likewise. Before feeding your cat, spend ten to fifteen minutes playing with her. Then put down the food, allow her fifteen minutes to eat and then clear up any leftovers. After your cat has eaten, it is time for another gentle play session. Call her to her litter box from a variety of places around your house, especially areas where she has soiled. When your cat gets to the box, scratch the litter to get her interested.
Similarly, throughout the day, whenever your cat has been asleep for over two hours, wake her up and call her to the litter box. Encourage your cat to hop into the litter box, praise her when she does so. Even if she does not eliminate, she is learning that the litter box is a great, CLEAN place to be. This is especially important for cats that are now avoiding the litter box because they assume it is always dirty or because they associate it with being punished. If your cat does eliminate, praise her in a gentle voice. Once she has finished, gently stroke her, give her a treat and take the time to tell her how pleased you are with her behavior.