It's just a case of translation
Let's see what other commentaries contain
Sri Ramanuja's commentary of the same verse:
As the ‘one sun’ illumines ‘all this world’ by his radiance, so the ‘knower of the body’ illumines the entire Ksetra, i.e., the body, by Its own knowledge, within and without and from head to toe, by conceiving ‘This my body is of this nature.’ This self of the said nature is totally different from the body, because It is the knower of the body. The body is the object of Its knowledge and is therefore different from It, even as the illuminating sun is totally different from the illumined world.
Sri Shankaracharya's commentary of the gita:
Yatha, as; ekam, the one; ravih, sun; prakasayati, illumines; imam, this; krtsnam, whole; lokam, world tatha, similarly;-who?-ksetri, the Knower of the field, i.e. the supreme Self, though one; prakasayati, illumines; krtsnam, the whole; ksetram, field, from the ‘great elements’ to ‘fortitude’ (cf. 5-6). Here the illustration of the sun serves to highlight two aspects of the Self, viz that, like the sun, the Self is one in all the fields, and that It remains unaffected. This verse is meant for summarizing the idea of the whole of this chapter:
Bhagavad Gita as it is:
O son of Bharata, as the sun alone illuminates all this universe, so does the living entity, one within the body, illuminate the entire body by consciousness.
So basically loka means 'world' in sanskrit. However the word 'world' does not have any one specific meaning. World could mean planet which in this case is Earth, it could mean this Universe, or it could mean anything.
Here is the list of possible meanings of the word 'world' [reference: wiki]
- the earth, together with all of its countries, peoples, and natural features.
- all of the people, societies, and institutions on the earth.
- the material universe or all that exists; everything.
- group of living things.
- the people, places, and activities to do with a particular thing.
Now you tell me, what did Sri Krishna mean when He said 'world'? Since you already know that the Sun illumines the Earth, and not the Universe, and as you rightly said, Sri Krishna knows everything, so here are the two possible answers:
- The word 'loka' does not refer to Universe in this specific context. or
- The Sun referred to here is not the Physical sun, but rather the more general Sun-concept (for example, we say each solar system has its own Sun, but actually each solar system has its own 'Star'. It is only the star in our system that is called the 'Sun' but still we use it interchangeably).
All the best!!