There are two possible answers to this question. The first is that your Pokémon is hacked. Hacked Pokémon cannot be used in any online capacity. The second possibility is that legendary and mythical Pokémon are prohibited from participating in Max Raid Battles, but I've never heard of this being the case. Unfortunately, details on the lastest games are vague in the extreme on most websites, so it's hard to find concrete information.
Source: Bulbapedia and Serebii (neither state that any Pokémon are unusable in Max Raid Battles and Flygon is not a legendary or mythical Pokémon, so the first possibility is much more likely)