In the Close Combat phase, enemy models in base contact with both the character and one or more models from the character's unit can choose to attack the character or the unit, or split their attacks between them. You need to declare where attacks are being allocated before they are rolled. If the character is slain, any excess wounds do not carry over onto the rest of the unit but are simply lost.
Remember that models can only attack enemies in close combat if they are in base contact. Therefore, if enemy models are only in base contact with the character, then they can only attack him. If enemies are only in base contact with models from the character's unit, they must attack the unit.