I would like to piggyback on this question: If someone can sing a melody, why can they not also recognize the intervals within that melody?
The OP is asking why it is easy to sing a song we know, meaning we memorized the intervals, why is it difficult to name intervals when we hear them.
My twist on this is:
If I play with apps that train me to recognize intervals, it takes some warmup period before I'm able to do it decently, then accuracy goes up. But somehow, each time I try to play again, I am back to the same, without the warming up I'm not so good. But overall, if this was a competition, I wouldn't be so good, despite having started to play instruments some 40 years ago :)
However, when I hear an interval, I'm usually able not only to replicate it on a guitar with good accuracy, but I'll hit the first note quite close to the original as well.
(To some extent I can do it on the piano too, but not as well as on the guitar.)
Has anyone an idea why there is such a difference?