A body of mass m is placed on flat surface (without friction). String pulls this body to the right with tension ma. The body accelerates to the right, and inertial force ma acts to the left. Magnitude of tension and inertial force are equal. This is as shown by Newton's third law of motion.
The fact that gravity and inertial force are equal (in total) in a free-falling elevator is probably due to Newton's third law of motion.