Moodle normally redirect to login page when session Timeout.
Is there any option to redirect another page url instead of going to
$CFG->wwwroot.'/login/index.php'
Yes by using redirect()
function, you can redirect from one page to another page in moodle.
Example
$urltogo= $CFG->wwwroot.'/dashboard/';
redirect($urltogo);