I'm not particularly sure about the syntax as I haven't worked with codeigniter but you could try this:
<?php
$tags['tags'] = explode(",",$main_info['tags']);
$tags['id_tag'] = explode(",",$main_info['id_tag']);
foreach($tags['tags'] as $k=>$v): ?>
<a href="<?php echo base_url('tag/'.$tags['id_tag'][$k])?>"><?php echo $v ?></a>
<?php endforeach ?>