In the beginning of Exodus, there were 12 tribes.
At the foot of Mt. Sinai, during Calf-Gate, the tribe of Levi was split off from the 12 and set aside to be priests. This was because the tribe of Levi alone refrained from the revelling going on at the foot of the mountain during Moses’ 40 day Sabbatical with God.
This left 11 tribes.
To reconstitute the number of tribes back to 12, the 1 tribe of Joseph was split into 2 tribes, Ephraim and Manasseh. As mentioned above, these two tribes were the 2 sons of Joseph.
When the 12 Tribes (plus Levi) entered the promised land, the Levites weren’t given a territory like the other tribes. Instead, the Levites were given cities in each of the other tribe’s territories, so that they could serve as priests among the people.