An unfortunate number of coincidences. The coincidences all ended up converging in Sans Serif Latin script, because a vertical line is a simple thing, and any simplification of glyphs can’t get any simpler than a | .
The letter I started as Phoenecian https://en.wikipedia.org/wiki/Yodh, which did not look like a |:
But by the time the Greeks were done with it, it did (from: Archaic Greek alphabets):
There was no number 1 or lowercase l back then to cause trouble.
The number 1 actually went a curious journey from Indian to Arabic to European numbers, as summarised in 1 (number):
So: ⼀ to १ to ۱ to 1.
Simplify the Devanagari or Roman serifed glyph, and you get the Arabic and Roman sans serif glyph: a vertical line. The vertical line ended up ambiguous in Arabic with alef, too: ا ۱.
The lowercase l did in fact emerge out of capital L, by shortening the bottom of the L in Rustic capitals. As you can see (source: History of the Latin alphabet), the history of <I> and <l> has been an attempt to fix the resulting ambiguity, including different sizing, serifs, and tittles. The distinction between capitals and lowercase was more pronounced in mediaeval script than after the invention of printing, so I/l wasn’t as much of a problem back then.