You can take this as an example to understand the difference:
A ball is falling towards earth. There exists an force of gravitational interaction between them which is equal in magnitude and attractive in nature. Consider 2 cases of systems:
System 1 : Ball + Earth
When you draw the FBD for this system you would notice that the gravitational interaction doesn't even come into it because its an internal force for this system. So you wouldn't consider the work done by it.
System 2: Only Ball
In this case, the gravitational force is an external force on the ball. The displacement of the ball is in the direction of this force. Hence positive work is done by the gravitational force.
This is similar to the chain on the table problem. When our system is "The whole chain" tension becomes an internal force but if our system is "unit length element of the chain" tension is an external force on this and would do work on it.