School brings marks, red corrections and comparisons with others. Some children then become so afraid of getting things wrong that they'd rather not try. “I can't” quickly turns into “I don't want to”.
Example works best. When your child sees an adult get something wrong, say so calmly and try again, they learn that mistakes are a normal part of doing anything – not something to be ashamed of.