Prob cos of who mapped it,,,,, sorry tongue in cheek joke, i wouldn't trust the clown to map my toaster, but reality is it could be nothing to do with that.
Second hand engines are just that, you don't know how it was treated before you got it. I would always a have a fully rebuilt engine so its a know thing. But that said could be any number of reason from human error during assembly or just mechanical failure.
what ever happens it's worth stripping it to fully and assess whats gone, could be more than just headgasket, if it is as its had a hard life could find the bearings are worn etc.