If the key is a copy of an original, or a copy of a copy, or old and worn, it might not be the perfect shape anymore. If you have the original key code you can have a locksmith or a dealership make you a brand new key.
The key to your nissan maxima may have been damaged or bent some kind of way. You should always keep a spare just in case anything happens. If you do have a spare make another copy of it.
It is frustrating when your car door key does not work. Many times this is because the battery in the key attachment has lost its power, and the simple fix is to get a new key battery. The problem is many times this means a trip to the dealer to get it done.
If you are referring to the key not unlocking the lock when you place it into the lock then that could be because of a bad cut. Have the key made again from a GOOD working orginal or copy.