Another interpretation of (Genesis 38:1) "And Judah went down": Once they had sold Joseph, what is written? "And Reuben returned unto the pit" (Genesis 37:29). Since he did not find him, he rent his garments. Then they all arose and scattered, and Judah too scattered with them. [Hence] "And Judah went down."
Why Judah Went Down After the Brothers Sold Joseph
Midrash Tanchuma Buber, Vayeshev 12:2
ד"א וירד יהודה, כיון שמכרו את יוסף מה כתיב, וישב ראובן אל הבור (בראשית לג כט), כיון שלא מצאו קרע את בגדיו, אף כולם עמדו ונתפזרו, ואף יהודה נתפזר עמהם, [הוי] וירד יהודה.