Why does the lane in a 50m pool have to be 2.5m width?

Two reasons.

First, it provides ample room for swimmers to spread their arms when performing certain strokes (the breaststroke and butterfly strokes both involve the arms swinging around to the side while being pretty flat relative to the surface). This requires sufficient width to prevent accidental collisions.

Second, it (along with the lane dividers) helps to reduce the cross-lane turbulence. One swimmer's wake can interfere with (or in some cases, even help) a swimmer in an adjacent lane.