I’ve never heard of them coming from birds nests, that seems a bit odd as most birds would eat them but maybe if it’s an abandoned nest with old food left in it they could be in there.
I think it’s often a bit of a mystery where they come from, I’ve only ever seen them twice, the first time many years ago they were in a bag of flour & if it had just been eggs or larvae I might not even have noticed, I did have them in a bag of hamster food with my first ham, long before I’d thought about freezing food but I just binned the bag & that was it.
They can be in any dry food though & get into even the tiniest cracks in cupboards & things so it’s probably easy to miss them until it’s a bit late.