Paul Mitchell, 27, of Rubery was arrested and charged after entering the field of play in the early stages of the Sky Bet Championship game at St Andrew's and hitting Grealish around the back of the head and neck. Mitchell pleaded guilty on both counts.
Mitchell was ordered to pay £350 in costs, including £100 in compensation to Grealish. He has also been given a 10-year football banning order from all stadiums.
His solicitor told Birmingham Magistrates' Court: "He cannot explain what came over him yesterday morning. His initial foolish intention was to just go on to the pitch and whip up the crowd."
Prosecutor Jonathan Purser told the court Grealish felt lasting pain after the incident but had suffered no substantial injury from a punch to the right side of his jaw.
In a statement read into the court record by Mr Purser, the Villa captain said: "I cannot help but feel how lucky I was in this incident. It could have been so much worse had the supporter had some sort of weapon."
Mitchell was dragged off the pitch after being taken to the ground by a combination of Birmingham and Villa players, as well as stewards who followed him on to the pitch.
Birmingham promptly revealed the individual would be banned from their stadium for life and said: "What happened has no place in football or society. Jack is a Birmingham lad and regardless of club allegiance should not have been subjected to this - there are no excuses.
"The club can confirm that Mr Mitchell is banned from our home ground, the St. Andrew's Trillion Trophy Stadium, for life. And nor will he have access to purchase tickets for away games involving Birmingham City Football Club, or have tickets purchased on his behalf.
"The club has also banned another supporter for life for a series of vile and malicious tweets on social media, relating to Jack Grealish and his family.
"The individual in question remains the subject of an ongoing investigation by West Midlands Police.
"Birmingham City FC rejects all forms of anti-social behaviour. We will not tolerate the kind of incidents we have seen during and since Sunday's derby fixture against Aston Villa Football Club."
Grealish was able to play on after the attack and went on to score what turned out to be the winning goal as Dean Smith's side prevailed 1-0.