One of the many ways to bungle a work of fiction is to create a plot that only makes sense if one of the lead characters is a complete idiot. If your hero acts like a complete idiot, readers will lose all sympathy with him. If the villain is a complete idiot, you haven’t given your hero enough of a challenge.
Some years ago I read a science-fiction novel — mercifully, I can’t remember the author or the name of the book — in which some people set up a base on an alien world and then wander off into the local wilderness without bothering to carry any weapons. Because, you know, what could possibly go wrong?
In the interest of getting the story to move in the direction you need it to, you may occasionally need a character to do something that is against her own best interest — something that she should know better than to do. The way to handle this is to give the reader some interior monolog in which the character debates a few courses of action and consciously chooses the wrong course for reasons that seem compelling to her at that moment, even though she knows she may be letting herself in for a heap of into trouble.
Producing a plausible rationale for idiotic behavior is tricky, but possible. If you’re having trouble writing a paragraph in which the character weighs his choices and then makes a bad decision — if all of the reasons that you try to give the character are silly — then maybe you need to rethink the plot.