Both are very good smartphone for gaming, both comes with Snapdragon 801. Let's comes with and check out their specification:-
Specification of SAMSUNG GALAXY S5:
Your Finger is Your Key - Finger Scanner
Ultra Power Saving Mode
Adonis Prime2 (Quad 1.9 GHz + Quad 1.3 GHz) + XMM6360 Processor
Fast Auto Focus and Selective Focus
16 MP Primary Camera
IP67 Certificated Dust and Water Resistant
Android v4.4.2 (KitKat) OS
Healthier Lifestyle - Heart Rate Sensor
HTC ONE M8:-
HTC UltraPixel Primary Camera
5-inch Touchscreen
Expandable Storage Capacity of 128 GB
2.5 GHz Qualcomm Snapdragon 801 Quad Core Processor
5 MP Secondary Camera
Wi-Fi Enabled
Full HD Recording
Android OS