Because Magic Gaurd prevents damage from anything other than an enemy attack, but Explosion doesn't deal "damage" to the user, it faints the user as a direct consequence of using the move.
because magic guard prevents only indirect or recoil damage. explosion causes the user to faint 100% so it is not a recoil damage. It is more like blowing up yourself and cause massive damage to the foe