Bad luck, most likely lack of acclimation as paddone said.
If I can make a suggestion, next time use a quarantine tank. I use a foodsafe 30L plastic tub from Wilko's.
What you can do is make up water to match what's in the bag then gradually adjust it to match your tank.
Better still, keep him in there a while and observe him in case of parasites, check he's eating etc.
I keep a small bit of sponge in the main tank, so whenever I want to buy a fish I always have a bit I can put in the quarantine tank to act as the bio filter.
Equipment-wise, I just use a 25w heater and cheap powerhead from allpond.
Sent from my Mi A1 using Tapatalk