Ellicott's Commentary On The Whole Bible
1 Chronicles 21 - Introduction
XXI.
The census, and consequent plague. The hallowing of the Temple area. Omitting the magnificent ode which David sang to his deliverer (2 Samuel 22), and the last words of David (2 Samuel 23:1), as well as the list of David’s heroes (2 Samuel 23:8), which has already been repeated in 1 Chronicles 11, the chronicler resumes the ancient narrative at the point coincident with 2 Samuel 24 (See the notes there.) Though the two accounts obviously had a common basis, the deviations of our text from that of Samuel are much more numerous and noteworthy than is usual. They are generally explicable by reference to the special purpose and tendency of the writer.
In Samuel the narrative of the census comes in as a kind of appendix to the history of David; here it serves to introduce the account of the preparations for building the Temple, and the organisation of its ministry.