Great question! I’ve downloaded quite a few Github games over the years. Most of them are free and open-source, so there’s generally no cost to play. That said, “legit” depends on your definition they’re legitimate in the sense that developers share the source code, but they’re not always polished releases like Steam games.
Safety wise, most reputable projects have lots of stars and community feedback. But as with any open-source repo, always look at the code (or at least the issues/pull requests) before running anything. Run them in a container or VM if you’re unsure.