Myocarditis is primarily caused by viral infections, such as those from the Coxsackievirus, adenovirus, or influenza. Other causes include bacterial infections, autoimmune diseases, medications, and certain toxins.