I’m not saying that this is the case with your son, but I am a special Education teacher and I worked with a child who had selective mutism, which is an anxiety disorder. He talked a lot at home but not at school, where he did not feel as comfortable as he did at home. The great news is that there is help for this difficulty. Ask your child’s teacher or pediatrician for recommendations for an evaluation. Your son is very young so this difficulty might improve as he ages. If it does not improve on its own, get the help he needs.