The models shown in TPM were OOM-series which are described as being smarter than the initial batch of B1's. The B1's were mass produced to eventually replace the OOM-series for the Clone Wars.
As to why the B1's behaved the way they did, this if from their article on Wookiepedia:
Although the earlier generations were entirely dependent on Central
Control Computers, post-Naboo models were retrofitted with cognitive
models that allowed independent thought, and featured a greater degree
of independence and personality. However, labored with more and more
specialized roles that pushed the limits of their programming, many
older droids developed personality quirks and a tendency to
excessively comment on their situations in an attempt to handle the
data overflow that had strained their old logic modules.
In case you are wondering why the B1's weren't all that smart in general, here is a good post on the subject.