Jealousy is bad, right? It's like envy. It means you're unhappy that somebody else has something you want, or that you might lose what you have -- whether it's stuff or a position or a relationship.
So when God says, "I, the Lord your God, am a jealous God," we see that as a flaw.
Sometimes people think God has an ego problem: "Hey, don't worship anybody else. I'm the Big Cheese here, and I want your praise and your accolades."
Sometimes people think God gets hacked off when we don't honor him as we should. It must hurt His feelings, they think. Why can't He get over His pettiness, they think.
If you're a parent, you know the terror-of-heart as your beloved child runs toward the busy street. Or embarks upon some other stupid stunt that's quite likely to endanger him. If you're not a parent, you probably remember your own confusion after you did something idiotic as a kid. "Why are you so mad at me, Mom??! You're glad I didn't get hurt, but you're mad too."
The Lord is jealous. And it's not about His ego or His feelings. It's because what hurts Him most is when we insist on harming ourselves. He loves. He cares. He gives. And when we run off into the busy street, when we run off into danger, it grieves Him. Not because it damages Him. But because it hurts us. And that is why He is "a jealous God." It's for our protection, for our benefit. Not for His.
He is the source of life. When we leave Him, we turn our back on life, and the only thing left is death. That's why He's jealous for us: He wants us to have life, and have it abundantly.