Urination at greetings (often referred to as submissive urination) is an appeasement gesture. It's pretty common in puppies, and most grow out of it, but some dogs continue to adulthood or develop the behavior later on. Dogs tend to do it when they're nervous, confused, or excited, perhaps to the point of being a little overwhelmed, and want to please you. It's like them bending over backwards to make sure they're showing respect, but unfortunately how dogs show respect is not always socially appropriate around people.
Never punish him when he does this - that's essentially telling him "I'm not pleased with your current performance, you'll have to do better" and often just makes the problem worse. They assume they have to be even more deferential at greetings, which means more stress and more peeing. Instead, work on building his confidence and give him something to do that will help him feel more relaxed and self-assured. Maybe instead of usual greetings, guests can toss him treats, or throw a ball for him. Sometimes how you approach a dog (especially a small dog) can make a big difference. Sit down on the floor and let him come to you rather than bending over to greet him. Immediately clip on his leash or let him out in the yard and do your greetings somewhere pee-appropriate. Train him to go into his kennel and give him a stuffed Kong or other long-lasting treat to keep him occupied until he and the guests are settled.
You may also want to try a belly band with him while working on the issue to prevent messes. It may actually discourage him from going in the first place.
More info from PetMD
I think it has something to do with excitement from being around other people. Especially since it mite be a puppy.