It's normal for phone to heat up during fast charging, but while playing games it should warm a bit, not heat up. Provided with proper ventilation it should be working cool. Do you use cover while playing games or charging? If so, try removing your back cover while charging and playing heavy games.
Which game you play? I play PUBG at smooth and high fps settings, it'll never reach 42°C max 40°C playing like 2hrs, i didn't notice any overheating issues from day of purchase. I also play Asphalt 8 it even runs cool like 39°C after 1hr of gameplay