This is natural behaviour for a new puppy as they want to know about everything that is new to them. A puppy will assume everyone has come to see them rather than you.
There is a danger of you tripping over your puppy and it can become a nuisance for friends who are visiting you to the point you may find the visitors start to stay away.
To help your puppy understand door training you may have to enlist help from a family member or a close friend.
Ask your visitor to come to the door and to ignore your puppy when you open the door. This training exercise will work better if your puppy is on a lead so that they cannot jump up at your visitor.
Take your time and lead your puppy to a designated place. Greet your visitor and reward your puppy for staying still. Give your puppy lots of attention and offer them a small treat.
It will only be a short time before your puppy prefers to wait for you and their treat, not your visitor. Eventually you will be able to stop the treats but continue with the praise for your puppy.
Do not spoil your work by smacking your puppy if they sometimes forget the routine, just start again.