In the simulation of electromagnetic (EM) scattering under the excitation of an EM pulse, high spatial resolution is needed in the regions with fast field oscillations, which propagate in space and time. The use of a uniformly dense mesh in the entire solution domain would increase the number of degrees of freedom and the resulting simulation time significantly. To efficiently capture the variation of EM fields, a discontinuous Galerkin time-domain algorithm with dynamic h-adaptation is presented, which changes the resolution of each mesh element in real time based on the gradient of EM fields. Also, it is combined with a local time-stepping scheme to alleviate the restriction on time step size due to the stability condition. It is shown by a numerical example that with the method presented in this paper, the computational time can be reduced effectively.