Nurseries have a lot of old books, and TV channels repeat a lot of old cartoons & other shows, so a kid may be exposed to old-style phones in passing quite a lot. And “in passing” is enough at that stage, when a growing brain readily hoovers up any and all available information.
I've found the answer to pretty much every "how do they know that?" is "A TV show". Although now that the older one can read and is in-person school, the answer is increasingly "Books" or "Someone at school".
Eventually I gave him a real handset from an old rotary phone to play with. He might never have the experience of calling someone on it, but babies are at least able to figure out pretty quickly how to use these things in play.
It's the thing they see at grandma and grandpa's house.