The Prisoner's Dilemma is a thought experiment that utilises game theory to determine the best choice for individual members of a group to make when the outcome depends on the unknown choices made by each member. Essentially it is about balancing cooperation and competition to achieve optimal outcomes.
(It doesn't only apply to prisoners, it was just the best example of how the dilemma works.)
Eg. 2 co-conspirators are arrested, separated, with no way to communicate, and presented with 4 options.
1, confess and turn on your associate. You get immunity.
2, your associate confesses and turns on you. You get the maximum.
3, both confess. Both serve 2 years.
4, neither confesses. Both serve 1 year.
In this case the best option (since neither can know, for certain, what the other has chosen) is to confess (compete) because it gives the best outcome regardless of the other person's choice. The worst you'll get is 2 years in prison, at best you go free.
Not confessing (cooperating) runs the risk of taking all the blame and serving the maximum.