It happens one way only. A pawn captured something, and capturing moved it sideways onto a file its friend was already on.
The first problem is the one people forget. A pawn defends diagonally, so the pawn behind can never defend the pawn in front.
They are on the same file, and a pawn cannot defend straight up the file it stands on.
The second problem is that they are slow. Two pawns on one file can only ever cover the squares one pawn would cover.
And the third is the one that decides endgames. A file next door is now empty, because the pawn that used to be there is the one that got doubled.
And it does not stop at two. Three pawns on one file is three pawns doing one pawn's job.
So the count that matters is not how many pawns you have. It is how many files they are spread across.
Two white pawns, both on the b-file, one behind the other. That is a doubled pawn.