Anderson, wearing a black T-shirt and supported in the gallery by two male family members, smiled as he was sentenced to 16 weeks in prison on Wednesday. He was also ordered to pay a £115 victim surcharge and £100 in compensation.
The court was shown CCTV of Anderson driving his white van alongside Sterling's car as the player waited to enter City's CFA training ground on Clayton Lane on Saturday morning, in preparation for the Premier League game against Tottenham that evening.
Both men then got out of their vehicles and Anderson walked towards Sterling, who joined City from Liverpool for an initial £44 million in July 2015.
Carl Miles, prosecuting, said Anderson, who had been in the vehicle with his partner, began shouting racial abuse at Sterling and called him "you black Scouse c---."
He said Anderson also told the footballer, who has a young son and daughter: "I hope your mother and child wake up dead in the morning you n-----."
Mr Miles added: "He approaches Mr Sterling and can be seen to be bouncing on the balls of his feet. He sets out kicking Mr Sterling to the legs on four occasions."
The court was told that Sterling was left with a sore left hamstring after the attack but he did not suffer serious injuries. The player went on to score twice in City's 4-1 win over Spurs.