In this passage I was confused as to why God grew angry at Israel and David for numbering his people (taking a census.) 

According to this website: it says “As to why God was angry at David, in those times, a man only had the right to count or number what belonged to him. Israel did not belong to David; Israel belonged to God.”

They also speculate that it was Satan who tempted David to take a census of his people. 

Another website corroborates this theory by saying ” 1 Chronicles 21:1 And Satan stood up against Israel, and provoked (Hebrew two sooth) David to number Israel. ‘Satan’ in Hebrew means ‘adversary’. In Numbers 22:22 ‘satan’ is properly translated as ‘adversary’.”