Mikkel Becker in VetStreet:
Dogs whine for a variety of reasons. Your dog may whine because he wants something or because he is excited. He may whine because he is apprehensive or anxious about something. A dog who is showing appeasement behavior may whine as part of his interaction with other dogs or people.
How do you handle whining?
The best way to handle whining is to identify the cause of the behavior and change your dog’s behavior through reward-based training. As with any situation where your dog is exhibiting heightened anxiety, punishment is not a useful training tool. If you punish your dog for whining, the vocalization may cease, but his anxiety will not change. In fact, it may very likely become worse, and your dog may respond in a more dangerous way, such as biting.
So, dogs whine for the same reasons that people whine.