We study the chiral behavior of the electromagnetic (EM) form factors of pion and kaon in three-flavor lattice QCD. In order to make a direct comparison of the lattice data with chiral perturbation theory (ChPT), we employ the overlap quark action that has exact chiral symmetry. Gauge ensembles are generated at a lattice spacing of 0.11 fm with four pion masses ranging between M_pi simeq 290 MeV and 540 MeV and with a strange quark mass m_s close to its physical value. We utilize the all-to-all quark propagator technique to calculate the EM form factors with high precision. Their dependence on m_s and on the momentum transfer is studied by using the reweighting technique and the twisted boundary conditions for the quark fields, respectively. A detailed comparison with SU(2) and SU(3) ChPT reveals that the next-to-next-to-leading order terms in the chiral expansion are important to describe the chiral behavior of the form factors in the pion mass range studied in this work. We estimate the relevant low-energy constants and the charge radii, and find reasonable agreement with phenomenological and experimental results.