We know Genesis was written by Moses under the instruction of God because Moses never lived through the timeline of Genesis. Under the blessing of the twelve tribes, it was recorded that kingship shall come from Judah Tribe.
Genesis 49:9 Judah is a young lion— my son, you return from the prey...