Several factors can make a cat afraid of the litter box.
Medical issues such as urinary tract infections, constipation, or kidney disease can make elimination painful. Litter box problems include a dirty box, wrong litter type, poor location, too few boxes, or previous negative experiences. Environmental changes like a new cat, new furniture, or strong cleaning products can also cause stress. Behavioral issues such as anxiety or spraying may play a role.
Consult a veterinarian to rule out medical conditions, clean the box frequently, experiment with different litters, choose a quiet location, provide enough boxes, reduce stress, and use positive reinforcement. A feline behaviorist can help if the problem persists.