Yes insects and other bugs do have tiny brains like humans have brains.
But an insect brain or bugs brain is not as important to the bug or insect as a humans brain is and even if the insect or bug were to lose it's head with it's brain it could still live for a few days as long as it doesn't lose enough of hemolymph which is like blood for bugs.
If they lose too much of that hemolymph when they lose their head and brain then the bug or other insect will die when it loses it's head.
Bugs and other insects also have hearts as well as the brain and the heart pumps the hemolymph fluid throughout the bugs body but does so differently that a humans heart does.