It is highly possible that Shang Tsung just read about Shinnok while studying his sorceries. It might just be common knowledge among practicioners of dark magic to know something about the literal fallen Elder God who waged war on the universe and was imprisioned in Hell eons ago.
Shao Kahn, the one who taught Shang Tsung his sorcery (in the original timeline) most likely knew about Shinnok - or knew him personally - and might have disclosed this to Shang.
Quan Chi obviously knew about Shinnok, being his arch-sorcerer in MK4, and then teamed up with Shang in MKDA.
If you are refering to how the new (Post-mk9) Shang knew about Shinnok, the answer is basically the same, he is a dark sorcerer trained by Shao Khan. The newest Shang, from MK1 (2023) should also know about Shinnok because the Titan Shang Tsung told him about previous timelines.
Short answer: might just be common knowledge among dark sorcerers, whatever timeline it is.