Well, as I said: socially inept.
At my chapel, I don’t socialize too often, mostly watch my children (3 under three) whole my stay at home wife socializes. There have now been three times when I have been socializing, and a well respected, middle aged gentleman from my chapel comes up, I acknowledge him, and then he starts his conversation with the person I was speaking to, cutting me out of the conversation.
It might help if you knew what they were talking about. Was he interrupting you because he had important information to give the other person? If not, then it was an interruption that could wait, since you already were engaged in conversation.
If it wasn't an emergency but he just doesn't have any patience, then the guy is trying to be condescending to you. Don't let him get away with it. You don't have to be rude, but you are not obliged to acknowledge him when he approaches. In the future, when you see him approaching, turn your back toward him and urge the person to whom you are speaking to also turn to face the same way, and then if possible you can begin slowly walking with him away from the approaching middle-aged man.
If you are speaking about something of particular interest you might consider exchanging phone numbers so you can continue later in the event you are interrupted. And in the final case if the same man tries to interrupt you, after you have selectively avoided acknowledging him and have drawn closer to the one you were speaking to, if the man attempts to interrupt, turn to him and firmly inform him that you are having a conversation, "If you don't mind." Then turn back to continue your conversation.
With some people you have to be firm or they'll walk all over you, sad to say. If you stand up to a bully, he might respect you.