Your mom had it right. Good script for any parent of young kids to use.
Be sure that your son has times when he is with just dad and you get time as an adult going out with your adult friend(s) without any kids along at all. Once he is in preschool and then school, that becomes easier, if you have some friends who are also around during the day while kids are in school.
I think most kids start to have preferences, or to want to avoid certain other kids, around your son's age.
The situation of going to someone else's home is different from getting along with kids on the playground, at the library story time, at the museum kiddie event....At those places, you or dad or some adult is around, and those kids will mostly be stranger kids he's seeing for a very limited time. The kids are all busily focused on the playground, the story, the craft, etc. It's tougher when you are in someone's home, or they come to yours, and the kids are told to play together but don't have some external focus like a craft or story or arranged activity as they have at these other places.
If your son really feels he doesn't like to go play with a certain kid who is a friend's child, and there is no other way to see your adult friend without the kids along, be sure to have something specific for them to do, and don't say "Go play" since that's very open-ended and a recipe for trouble. It really is OK then if they don't play together but one kid goes off to look at books while the other does Legos in another room, or give each kid his own bucket of Legos in different rooms without making a big deal of it. It's not socially unacceptable to just let them play apart or to bring a specific, engaging thing with your for them to do (again, together or apart).
I would try to listen and honor it when your son eventually says he's not keen on playing with little Jimmy. Tell him what your mom told you - we do have to interact nicely with people who aren't our close friends -- but also take care not to make your own time with friends into too many enforced play dates if the kids don't click. I've seen moms do that and the result is the adults get no time to talk anyway, because they are busy shushing or controlling the kids.