The handset which caught fire and exploded was the Samsung Galaxy Note 7. The Galaxy S7 and its variants were not affected. The Galaxy Note 7 was recalled and buyers were asked to return it as soon as they could in mid-2016.
The Galaxy Note 7 caught fire and exploded due to the usage of a faulty battery that was prone to heating up. Samsung issued a global recall of the device and refunded buyers who had purchased the handset.
The malfunction was caused by faulty cells manufactured by one of Samsung's suppliers. The issue was compounded by Samsung's attempt to solve the problem, which could have resulted in further defects.
There were several reported incidents of the Galaxy Note 7 catching fire and exploding due to the faulty battery, leading to the recall. Reports of other phones in the Samsung family catching fire and exploding due to the same faulty battery were false. The Note 7 was the only device affected.
Here's a link to more info on this topic: Samsung Galaxy Note 7 recall.