As a pendulum oscillates, potential energy gets converted into kinetic energy and vice versa.
If there are no losses in this transaction, then the oscillation would remain forever and ever.
But as the pendulum has to spend some energy against the air drag, a portion of the total energy is gradually lost as heat to the surroundings. Finally, there wouldn't be any energy for further transaction. As a result, the pendulum comes to rest..