I am studying Advaita Vedanta. According to Advaita Vedanta, this world is an illusion. It suggests one to do his duty with detachment. What I do not understand is why should one even do his duty when its clear that the world is an illusion?
Why should I do my duty
यस्त्विन्द्रियणि मनसा नियम्यार्भते अर्जुन। कर्मेन्द्रिये: कर्मयोगमसक्त: स विषिशय्ते।
Perform your prescribed duty, for doing so is better than not working. One cannot even maintain one’s physical body without work. BG 3.8
Adi Shankra's bhasya
Tvam, you, O Arjuna; kuru, perform; niyatam, the obligatory; karma, duties, those daily obligatory duties (nitya-karmas) or which one is competent (according to the scriptures), and which are not heard of [although no result of daily obligatory duties is mentioned in the scriptures, still Sankaracarya holds that it is either heaven or purification of the heart, because something done must have its consequence.-Tr.] as productive of any result; hi, for, from the point of view of result; karma, action; is jyayah, superior; akarmanah, to inaction, to non-performance (of duties). Why? Ca, and; akarmanah, through inaction; api, even; te sarira-yatra, the maintenance of your body; na prasiddhyet, will not be possible. Therefore, the distinction between action and in action is abvious in this world. ‘And as regards your ideea that action should not be udnertaken because it leads to bondage-that too is wrong.’ How?
Inspiration from Shriman Narayana/Bramhan
न मे पार्थास्तिकर्तव्यम् त्रिषुलोकेशुकिन्च्न । नाना वाप्तम् वातव्यम् वर्त एव च कर्मणि॥
O son of Pritha, there is no work prescribed for Me within all the three planetary systems(I would prefer Lokas). Nor am I in want of anything, nor have I a need to obtain anything—and yet I am engaged in prescribed duties. BG 3.22
Lord is Setting Example for us humans to do karma
यदिह्यहम् न वर्तेयम् जातुकर्मण्यतन्द्रित:। मम वर्त्मानु वर्तन्ते मनुष्या: पार्थसर्वष:॥
For if I ever failed to engage in carefully performing prescribed duties, O Partha, certainly all men would follow My path. BG 3.23
For more details and clarity you should read full Bhagwad Gita Chapter 3
If you want a non-mayavadi(where world is considered real) world view you can consider reading Bhagwad Ramanujacharya's commentary through the same links provided.