This study investigated the incidence and risk factors of perioperative clinical seizure and epilepsy in children after operation for CHD. We included 777 consecutive children who underwent operation from January 2013 to December 2016 at Kanagawa Children’s Medical Center, Kanagawa, Japan. Perinatal, perioperative, and follow-up medical data were collected. Elastic net regression and mediation analysis were performed to investigate risk factors of perioperative clinical seizure and epilepsy. Anatomic CHD classification was performed based on the preoperative echocardiograms; cardiac surgery was evaluated using Risk Adjustment in Congenital Heart Surgery 1. Twenty-three (3.0%) and 15 (1.9%) patients experienced perioperative clinical seizure and epilepsy, respectively. Partial regression coefficient with epilepsy as the objective variable for anatomical CHD classification, Risk Adjustment in Congenital Heart Surgery 1, and the number of surgeries was 0.367, 0.014, and 0.142, respectively. The proportion of indirect effects on epilepsy via perioperative clinical seizure was 22.0, 21.0, and 33.0%, respectively. The 15 patients with epilepsy included eight cases with cerebral infarction, two cases with cerebral haemorrhage, and three cases with hypoxic-ischaemic encephalopathy; white matter integrity was not found. Anatomical complexity of CHD, high-risk cardiac surgery, and multiple cardiac surgeries were identified as potential risk factors for developing epilepsy, with a low rate of indirect involvement via perioperative clinical seizure and a high rate of direct involvement independently of perioperative clinical seizure. Unlike white matter integrity, stroke and hypoxic-ischaemic encephalopathy were identified as potential factors for developing epilepsy.