It's possible, but that drive will need to be "checked" out first. What exact Mac model do you have now?
For checking out that drive, it will first need to be removed from your present "dead" machine. That is why you need to state what exact Mac model it is. Once you do that, it will need to installed inside an external case (they are not expensive). Then, after you get your "new" Mac, that external case will need to be connected to the new Mac, and then you would use Disk Utility there to check out the drive. Assuming all is well, you could do the transfer at that time. No need to install that drive inside your new Mac.
Also, how are you making posts here? What device are you using?