The 6000 year claim does not appear in Genesis, I do not know enough history to say but it's possible that YEC-ism is based on a modern invention of interpretation.
There are long chronologies in Genesis that include, "A lived for X years and begat B. B lived for Z years and at C." If you assume these are contiguous and precise, and that the meaning of "year" hasn't changed, and that Adam was "born" on day 6 of creation, and the universe was created 6*24 hours before that, then you can calculate when various Biblical events happened -- including when the world was made. Ussher made his estimate in the 1600s; according to that Wikipedia article, Rabbi Jose ben Halfata made an estimate as far back as the 2nd century AD.
But I'm pretty sure even in Ussher's time, there were lots of Christians who said that those kinds of calculations weren't necessarily useful or accurate: that the book of Genesis wasn't trying to teach people Geology, but Theology.
Read through the Babylonian creation myth [1], in which the Earth is created by the carcass of a murdered god ripped in half and humans are made from the droplets of blood of another god "to serve the gods", and ask yourself: "What is the world like? What is my place in it as a normal human being?" Then read Genesis 1 and ask yourself the same questions. You'd reach quite different conclusions.
Well, naturally it could not appear in Genesis, lacking any reasonable epoch point relative to which it could be defined. The 6000 year figure, at least in the Anglosphere, most likely derives from Archbishop James Ussher's genealogical calculations in the 17th century [1]. However, I don't think that has been any sort of common belief before the modern YEC movement.
Having grown out of a young-earth Creationist religion, I can say that the 6000 year claim is based on a rather fanatically literal interpretation of Genesis and the surrounding histories. Reading the genealogy of Genesis 5 and trusting that the ages are accurate, that they skip no one, and that Adam was literally created by God in year 0. With some simple addition, that genealogy gives a birth date for Abraham of about 2000 years after Adam. From there, a literal/historical/grammatical hermeneutic brings you to the Exodus and iron age histories that can pretty confidently assign real dates. Maybe it's just the indoctrination I grew up in that still empathizes with the ability to read "After Noah was 500 years old, he became the father of Shem, Ham, and Japheth" and say "yep, there's another 500 years on the chronology" and imagine that Christians have always done that.
"According to Hebrew time reckoning we are now in the 6th millennium. The Hebrew year count starts in year 3761 BCE, which the 12th-century Jewish philosopher Maimonides established as the biblical date of Creation."
YEC was always based on a lot of supposition and poor science and was mostly a reaction to the rise of evolution as a replacement explanation for the origin of life. Whether you believe Genesis or not YEC doesn't hold up when examined critically.