If a friend invited me over and they launched into an unsolicited cooking lesson, I would think they are a pretentious twat, lol. There’s always context of course, but I’m not looking for friends who push their knowledge on me without my invitation.
Mutual interests, or expressed interest to learn more in either direction, groovy. One way info dumping, nope.
Listen I brew beer. It can get kinda repetitive and boring. Sometimes I invite friends over to keep me company and I don’t lecture on sanitization and chemistry because that’s not what they came for. The occasional friend does want to learn about brewing, they express that wish, and then I explain some things to them. Some friendships are good for the former, some for the latter, and it’s on you to navigate which is which.
And/or the socialization. Maybe the intention to listen and learn was there, but overcome by the excitement of socializing with friendly people.