I have read bhagavad gita where krishna mentions maya to be a illusion and everything in this is world is made of maya. What I don't understand is if everything is made up of maya then why is krishna telling it, isn't that too maya ? and what about the moksha, isn't that also a delusion? Why should I still try to attain moksha if it is unreal?
Everything that we see and don't see, the whole of our material existence is made up of two primary components, prakriti and purusha:
saṃyuktametatkṣaramakṣaraṃ ca vyaktāvyaktaṃ bharate viśvamīśaḥ [Sve. Up. - 1.8]
-By the combination of perishable (prakruti) and imperishable (purusha), the lord fills the whole world with the manifest and unmanifest.
yāvat sañjāyate kiñcit sattvaṁ sthāvara-jaṅgamam
kṣetra-kṣetrajña-saṁyogāt tad viddhi bharatarṣabha [BG - 13.27]
O chief of the Bhāratas, know that whatever you see in existence, both the moving and the nonmoving, is only a combination of the ﬁeld of activities (prakriti) and the knower of the ﬁeld (purusha).
Of these two, prakruti is the inert and insentient part and purusha is the active sentient part. So all lifeless matter that we see starting from sand grains to matter in our bodies is the product of prakruti. But the other part known as Purusha is what gives life to matter. So we living beings are a marveolous fusion of prakruti and purusha. And it is this prakruti which is also known as maya, avidya (ignorance), etc.:
māyāṃ tu prakṛtiṃ vidyānmāyinaṃ ca maheśvaram [Sve. Up. - 4.10]
- Know that prakriti is maya itself and God is the lord of it.
Now the thing regarding maya is that, due to its influence the soul which is actually free finds itself in bondage. Mind is the product of prakriti, hence it naturally stays under the influence of the threefold material natures known as satva, rajas and tamas. These threefold nature arise due to prakriti or maya:
bikārāṃśca guṇāṃścaiva biddhi prakṛtisambhavān [BG - 13.20]
-Know that material nature and transformations arise from prakriti.
And because the mind of a person naturally stays under its influence, he does many kinds of material activities and gets entangled and bound in the samsara. Due to his actions under the influence of God's maya he keeps on wandering through different bodies:
īśvaraḥ sarva-bhūtānāṁ hṛd-deśe ’rjuna tiṣṭhati
bhrāmayan sarva-bhūtāni yantrārūḍhāni māyayā [BG - 18.61]
O Arjuna, God resides in the heart of every being and through His maya He is making them all wander as if they are seated on a machine.
But, beyond this material existence there exists spiritual existence entering where one doesn't have to return to this material world of pain and suffering again:
yaṁ prāpya na nivartante tad dhāma paramaṁ mama [BG - 8.21]
-That is my supreme abode, attaining which, one doesn't have to come back.
So because jiva is primarily spiritual in nature but has accepted this material mode of existence due to ignorance (maya), Shri Kirshna instructs to get rid of it and try for liberation.
Why does maya exist?
It exists because God exists. Just like heat and light are inherent properties of fire, maya is an inherent energy potential of God. Hence, it will always exist. So no one can destroy it completely, but can get rid of it for himself. So Shri Krishna says:
daivī hy eṣā guṇa-mayī mama māyā duratyayā
mām eva ye prapadyante māyām etāṁ taranti te [BG - 7.14]
This divine energy of Mine, consisting of the three modes of material nature, is difﬁcult to overcome. But those who approach (surrender) to Me alone, cross beyond it easily .
So the answers to your questions are as below:
- The whole world is not an illusion. Illusion means, unreal. But the world is not unreal. Maya is just one aspect of the existence, not whole of the existence.
- Krishna is telling about it, because ignorance is the foremost form of maya. By listening and understanding about the truth one gains knowledge which helps him destroy ignorance and get rid of maya.
- So moskha is not a delusion, it is the process or activity of getting rid of this material world and the endless circle of births and deaths. So moksha in one sense is the jiva's returning to its original home, back to the Godhead.
- Moksha is not unreal, hence you should try to attain it. Even just by acquiring the right knowledge and realizing it you will feel more happiness and peace here on this earth, what to speak of the bliss of liberation!
Thus I have briefly answered your questions. But the subject matter is such that it can occupy a whole book. But to summarize all, I end the answer with the following verse:
kṣaraṃ pradhānamamṛtākṣaraṃ haraḥ kṣarātmānāvīśate deva ekaḥ tasyābhidhyānādyojanāttattvabhāvādbhūyaścānte viśvamāyānivṛttiḥ [Sve. Up. - 1.10]
Primordial matter (pradhana / prakriti) is perishable. Immortal and imperishable is the soul. Both over the perishable and the soul rules one God. By meditating upon Him, by uniting with Him, and by becoming one with Him at the end one gets rid of all kinds of maya.
"Māyā" means "reality"
It can also mean "illusion", depending on your viewpoint. Literally, "mā" "yā" — that, which is not. Lord Krišna is the only puruša and īšvara or total enjoyer and controller above all states of existence (BG 4.6, 5.29). For all other, there are basically two states of reality — yoga māyā (BG 7.25) and mahā māyā (BG 7.26-27).
or parā prakriti facilitates the pastimes of the living entities in the spiritual world in connection with their (our) source (BG 9.13).
or aparā prakriti covers the full knowledge and constraints to material dualities of sense perception. This isolates those who do not cooperate with their source (BG 9.12).
Most of the Vedic instructions are about switching your perception of reality from material to transcendental, e.g. Bhagavad-gītā 7.28. The transcendental reality is supposed to be more enjoyable. However, it can still be called illusion, because someone like Nanda babā might think he is the father of Krishna, although actually Krishna is the original source and Nanda is actually His energy. Nonetheless, that relationship is extremely enjoyable for both of them.
can also be created by mystic beings like rākšasas, and people can also bewilder each other. Every woman is supposed to somewhat possess mystic abilities. These illusions can also be called "māyā", but they are not so general and permanent.