Not clear
It's left ambiguous by the film whether Gandalf was invited, or whether he merely showed up; the only clue from the dialogue is in an early scene of An Unexpected Journey:
Frodo: You think he'll come?
Bilbo: Who?
Frodo: Gandalf.
Bilbo: Ahhh. He wouldn't miss a chance to lit up his whizpoppers! He'll give us quite a show, you'll see.
Frodo: Alright then, I'm off.
Bilbo: Off to where?
Frodo: East Farthing woods. I'm going to surprise him.
The Hobbit: AN Unexpected Journey (2012)
From this dialogue, we can gather that:
- He's expected to appear
- They haven't been in contact with him to confirm it
So either they invited him and he didn't reply, or else he wasn't invited but they expected him to show up all the same.
Personally, I find the second of those to be the more likely; considering that the only way to send a message in Middle-earth is by courier1, and considering that hobbits as a rule don't much like to travel farther than Bree, and further considering that Gandalf is of no fixed address, it seems much simpler to assume that he had merely noted the date and turned up, fireworks in tow.
1 The postal system being rather limited to the Shire