It’s the governance of the preposition “na”—in this context, it requires the accusative form, which is “szczęśliwego”.
In general, prepositions take precedence before most (if not all) other parts of speech when deciding what case is required.
When you have a combination of a verb and a preposition, it is always the preposition that governs the case of what follows. Keeping this rule of thumb in mind will make your life much easier Here are two examples of such combinations:
- “patrzeć na” (“to look at”, requires the accusative)
- “iść do” (“to go to”, requires the genitive)
If you need a refresher on prepositions and the way they force other parts of speech to take the appropriate case, you can take a look at this blog post: https://www.clozemaster.com/blog/polish-prepositions/