Liam is a short form of
Uilliam, the Irish language form of
William. Back in the 1400s the diminutive of
Uilliam seems to have been Uillec. I don't have good information on when
Liam became the more common pet form in
Ireland, but it does not seem to have been used as a birth certificate form before the late 19th century.
https://omaha.com/lifestyles/cleveland-evans-irish-nickname-liam-on-international-rise/article_2556ef6f-4922-59df-8ec7-461b6373bdcb.html