Pavlov accidentally discovered classical conditioning while studying digestion in dogs. He noticed that the dogs would salivate when they heard a bell, which he had previously rung before feeding them. Intrigued, Pavlov extensively studied this phenomenon whereby a neutral stimulus like a bell could become associated with an unconditioned stimulus like food and elicit the same response, salivation, even when presented alone. His experiments demonstrated that learning occurs through the association and pairing of stimuli and responses, forming the basis of classical conditioning theory.