These three Lokas are mentioned in various scriptures.
For example, in ChAndogya Upanishad 2.17.1:
prithivi hingkArohantariksham prastAvo dayurudgitho
pratihArah samudro nidhanmetAh shakkaryo lokeshuu protAh ||
Prithvi is the HingkAra. Antariksha is PrastAva, Dyuloka is Udgitha, the directions are PratihAra and the ocean is Nidhana.
This SAman named Sakkari is established in these worlds.
In this verse is prescribed a mode of worship where a SAman Mantra called Sakkari is said to be established in the various Lokas and thus it should be worshipped being viewed as identical with those Lokas (worlds).
Therefore the five components of the SAman are said to be identical with the three worlds, the directions and ocean.
So, the three Lokas are Prithivi (Earth), Antariksha (Mid-world or Sky) and Dyuloka (Heavens).
Similarly, in ChAndogya Upanishad 2.23.2 it is stated that Lord PrajApati meditated on these Lokas and as a result of which the three VedaVidyAs (Rik, Yajus and SAmans) emerged and eventually the three alphabets viz- Bhu, Bhuvah and Swah evolved.
The verse is as given below:
PrajApatirlokAnabhyatapat tebhyohabhitaptebhyas traiyvidya
tAmabhyatapat tasya abhitaptAyA etyAn aksharAni
samprAsravanta bhurbhuvah swariti ||
These three letters, known as the Vyahriti Trayas, correspond to the three Lokas as follows:
Bhu --- The Earth, Bhuvah --- The Midworld or Sky and Swah --- The Heavens. We also say Bhurloka, Bhuvarloka and Swarloka that's why.
The same thing is mentioned in other scriptures like Manu Smriti:
2.232. He who neglects not those three, (even after he has become) a householder, will conquer the three worlds and, radiant in body
like a god, he will enjoy bliss in heaven.
2.233. By honouring his mother he gains this world, by honouring his father the middle sphere, but by obedience to his teacher the world of
If we want to include the Nether worlds (Atala,Vitala, PAtAla etc) then those will not come in the three Lokas' list but we have to consider the 14 Lokas instead (7 higher and 7 lower Lokas).