Hello! This link is a bit wordy but contains good information:
"The overall journey to becoming a practicing pediatrician involves four years of undergraduate studies, four years of medical school and three years of residency."
If you decide to specialize in a certain kind of pediatrics (cancer treatment, for example), that may involve a couple more years. Specialization programs after residency are called "fellowships".
p.s. as an undergraduate, you can major in anything, as long as you complete your pre-med courses and do well in them!