Myocarditis can be caused by lots of different things like viruses (including the common cold), parasites (more common in South America, less so here), various medicines (like penicillin), consuming alcohol, and many other things. You can learn more about the causes from the Myocarditis Foundation: https://www.myocarditisfoundation.org/research-and-grants/faqs/causes-of-myocarditis/
Further, most cases don’t present any significant symptoms, which is why it’s often missed. The Big 10 started screening for it as part of their athlete health program. In fact, when the Big 10 checked athletes who had recovered from COVID-19, they found myocarditis in 2.3% of them (https://jamanetwork.com/journals/jamacardiology/fullarticle/2780548)
To answer your question, if you have a kid with no clinical presentation of myocarditis before the vaccine, and it suddenly appears after vaccination, it’s likely that the vaccine caused that. So far, the evidence seems to be that this happens in about 11 out of 1 million kids. The Big 10 study suggests that 23,000 out of 1 million kids who had COVID-19 have myocarditis.