To understand this, consider a particle that moves from point A to point B. The displacement of the particle is a vector that points from point A to point B. The magnitude of the displacement is the distance between points A and B, and the direction of the displacement is the direction from point A to point B.
Now, consider two different paths that the particle could have taken to move from point A to point B. One path might be a straight line, while the other path might be a zigzag path. The displacement of the particle is the same for both paths, because the initial and final positions of the particle are the same for both paths.
This is because displacement is a vector quantity, and vector quantities are independent of the path taken. For example, if you add two vectors together, the resulting vector is the same regardless of the order in which you add the vectors. This is because the order in which you add vectors does not change the initial and final positions of the vectors.
The same is true for displacement. The displacement of a particle is the same regardless of the path taken by the particle, because the initial and final positions of the particle are the same for all paths.