G.♣.
Daycares organize their days and structure their days that require kids to learn to sit still at such a young age because that's the only way to survive. That doesn't mean it's ideal for kids that age. Not every 12 month old is really ready for just 1 nap a day, but daycares often force it because they need that consistent schedule in order to be able to take care of that many kids. Not every 5 year old is ready to give up their nap, but most kindergartens don't have nap time.
What your son is doing is perfectly age appropriate. He's 2, and it's completely ok that he doesn't want to sit still. Some kids naturally do at that age. He doesn't. That's fine. Don't force him to do it.
One of the benefits of being a SAHM is that you can go with the flow on things like this. If what he was doing wasn't age appropriate, I would encourage you to find more ways to teach him those skills. But I would encourage you, instead, to not worry so much about story time at the library. You can still take him and look at books and play with the toys there. It's a great place to take him. But maybe story time right now is part of his bedtime routine when you're helping him settle down for sleep.