You'll note that in the first summary, the confusion matrix is labelled the OOB estimate
.
This stands for Out-of-Bag, and is not the same as directly predicting each observation in the training set on the forest. The latter will obviously be a biased estimate of accuracy, the OOB estimate less so (although OOB has it's critics as well; but it's at least more reasonable).
Basically, when you print the summary itself, it is taking each observation and only testing it on the trees on which it was not used, i.e. "out of bag". So the OOB predictions are essentially using only a subset of the trees in your forest (roughly 2/3 in general).
When you call predict on the training data directly, it is using trees where each observation was actually used in the tree construction, so it's not surprising that that version gets each one correct, while the OOB version has some misclassified.