Hi,
There are several ways you could have downloaded a game without realizing it. Some apps/games allow you to preorder them. So if you had previously clicked on the app's description, you could have queued a download months ago without realizing/remembering it. Also if you have family sharing, it could have been made by another family member, and that doesn't mean they have access to your apple ID, simply that the sharing is working correctly. Holding the phone without realizing the screen is on is a possibility that can lead to any kind of unexplained change. I know I'm guilty of that.
If you do have family sharing set up check out: How to share purchases with your family - Apple Support
And: How to download apps and content that your family members purchased - Apple Support
If not, check for unrecognized charges. You can check from settings > [name] > Media & Purchases > view account (if asked) > purchase History. If that doesn't reveal what you're looking for go to reportaproblem.apple.com by following the instructions in If you see 'apple.com/bill' on your billing statement - Apple Support
If you still beleive it is possible that your account was hacked, immediately Change your Apple ID password - Apple SupportOfficial Apple Support › en-us
Check your account information for changes by going to settings > [name] > Name, Phone Numbers, Email to ensure all your information is correct. Then go to settings > [name] > Password & Security. Ensure you're using Two-factor Authentication, the Trused phone number(s) is(are) good numbers that you can be reached at and that aren't likely to change frequently.
The following article has detailed step by step instructions to secure your account:
If you think your Apple ID has been compromised - Apple Support
For additional help, Contact Apple for support and service - Apple Support. The Technical Support advisors may have additional things they could check to ensure your account is secure.