I own a 2007 Pontiac Grand Prix. My remote key isn’t working to unlock my doors sometimes, but it always opens my trunk easily when I press it. Sometimes I have to press the unlock button over and over to open the doors, sometimes it never works, or sometimes it works the first time. I don’t know what to do to fix it.
It sounds to me like the fob contacts are giving up the ghost. If a battery replacement doesn't fix it, get a new clam shell for it. Just change out the guts (small electronic board) into the new clam shell. New clam shells usually come with the rubber insert which makes up the buttons. On the back of the rubber buttons is a contact point which wears out over time. Since you say the trunk button works, and I bet the lock button works as well, this is a pretty good indication the unlock button doesn't want to play anymore.
As an intermediate step before replacing the clam shell, you can clean the contacts (rubber button side and electronics portion) with some rubbing alcohol and a Q-Tip type swab. This may help it work for a while longer, but if this was the cause, it's more than likely going to go bad again in the near future.
The contacts going bad on the most used buttons is a regular thing for these years of GM fobs. You can find them most anywhere, from local parts stores to Amazon. Just look on the back of the fob (where you put your forefinger when pressing the buttons with your thumb) and get the fob part number from there to match up to what you're getting. Realize the cheap ones you get on eBay are just that ... cheap. They don't usually last too long.
Changing out the guts is no harder than changing your battery. Ensure the two halves are completely snapped together and that the o-ring is in place when you put it back together. This will ensure it is water tight and you won't have any issues going forward.