Yes a bug can have a heart attack because bugs do have hearts but the heart in a bug or insect is different and works different than a humans heart so the heart attack would be different than a humans heart attack.
Yes bugs and insects do have hearts that pump blood like fluid through the bugs or insects body.
But the bugs circulatory system and heart as well as the type of blood is different than a humans heart and blood and circulatory system.
The blood that bugs have that their hearts pump is known as Hemolymph which enters the bugs heart when it's relaxed.
Then the bugs heart pumps the Hemolymph throughout the body of the bug and not through veins like a human has that the blood goes through.
So a bug can have a heart attack like humans can but their hearts and blood system is different.