The OED's first citation is
1774 C. Clive Let. 13 Jan. in D. Garrick Private Corr. (1831) I. 604 But I suppose his father can, for he is a fine chatter-box.
but it's easy to find a couple of antedatings:
1761 C. Morell The History of James Lovegrove, Esq II 95 Hold, hold Chatter-box! To your Buſineſs—
1762 Monthly Review Vol. XXVI 112 a ratting braggadocio, a conceited fop, an eternal chatter-box!
Neither citation sheds any light on the etymology. But I note that prattle-box is obviously formed on the same lines as chatter-box and appears somewhat earlier:
1671 J. Glanvill Disc. H. Stubbe 2 Gross Ignoramusses, Illiterate Fools, Prattle-boxes, Catch-Dotterels,..Tories, Cheats, and poor Devils.
And prattle-basket is even earlier:
1602 N. Breton Mothers Blessing sig. E1 But if she be ilfauour'd, blind, and old, A prattle basket, or an idle slut.
I think these earlier forms provide support for chatter-box being originally understood as "a container full of idle talk".