Read this from Samsung's page:
Reasons your phone warms up
• During the initial setup after purchase or when restoring data
• Intensive Camera use
• Using apps that require more power or using apps for extended periods
• While multitasking (or, when running many apps in the background)
• Exposed to Extreme Heat
• Blocked Ventilation
• Poor Signal Strength
• Charging the battery with a damaged USB cable
• Device’s multipurpose jack is damaged or exposed to foreign materials, such as liquid, dust, metal powder, and pencil lead.
Ways to Cool Your Phone and Keep It Efficient
• Keep the device updated with the latest software.
• Remove the phone’s case
• Move it from direct sunlight
• Reduce the display brightness
• Deactivate the Wi-Fi, GPS, and Bluetooth features when not using them.
• Close apps that increase battery consumption or that run in the background when not in use.
• Delete unnecessary files or unused apps.
If the above doesnt work still you can also try soft resetting, last resort is a factory reset