Bayes' rule with a giant assumption
Naive Bayes applies Bayes' rule to compute P(class | features). The rule says: P(class | features) is proportional to P(features | class) times P(class). The 'naive' part is assuming all features are conditionally independent given the class. This is almost never true in reality: word frequencies in text are correlated, medical symptoms co-occur, pixels in an image are not independent. Yet the approximation works surprisingly well.
The algorithm counts class frequencies and conditional feature frequencies in training data, then uses these to score new examples. Training is fast (single pass through data), and prediction is a simple product of probabilities. No gradient descent, no hyperparameter tuning needed.
Why naive Bayes dominates text and spam
Despite the independence assumption being wildly violated, Naive Bayes wins on text classification and spam detection. The reason: with thousands of features (word counts), the independence assumption's damage is outweighed by the robustness of the probability estimation. A few correlations do not break the method.
Naive Bayes also handles high-dimensional sparse data well (most features are zero for a given sample), unlike distance-based methods that struggle in sparse spaces. It also provides probabilities, not just class labels. For many real-world tasks (spam filters, document categorization, sentiment analysis), a quick, interpretable Naive Bayes classifier beats a tuned neural network. Modern spam filters still use Naive Bayes variants under the hood, often combined with other signals.