Start with two pointers at both ends of the array. This gives you the widest possible container.
At each step, move the pointer pointing to the shorter line inward. Why? The area is limited by the shorter line. If you moved the taller pointer instead, the width decreases but the height stays the same (still limited by the shorter side). Area can only decrease.
By moving the shorter pointer, you might find a taller line that increases the height enough to compensate for the reduced width.
You never skip a potential maximum because any container involving the current shorter line and a line further inward would have smaller width AND the same height constraint.