At the opening of Act 1, Scene 5 of Shakespeare's Macbeth, the doctor shows resistance in believing the story told by Lady Macbeth's gentlewoman that Lady Macbeth sleepwalks each night, puts on a nightgown, opens up her closet, takes out a piece of paper, writes a letter on it, reads it, seals it, and goes back to bed. We see the doctor's hesitation to believe the story in his opening lines: "I have two nights watched with you but can perceive no truth in your report" (1-2). Hence, the doctor's later question concerning the candle Lady Macbeth is holding further shows his initial disbelief and that he is still trying to absorb the fullness of the problem.
At the beginning of the scene, the doctor feels just about ready to give up on observing Lady Macbeth at night, feeling convinced that Lady Macbeth's servant is either exaggerating the problem or making it up. However, just after the gentlewoman describes again what she observes and refuses to repeat what she has heard Lady Macbeth say while sleepwalking, Lady Macbeth appears, "with a taper," which means she is holding a candle. It's actually very unusual for a sleepwalker to be carrying a lit candle considering that the sleepwalker would have to also light the candle, which is a far more reasoned and conscientious action than a sleepwalker would be capable of. Hence, when the Doctor asks, "How came she by that light?," he is asking how she acquired the lit candle she is holding, which is also a sign that he is still in disbelief about the sleepwalking story. According to his logic, if she is holding a lit candle, it's unlikely that she is truly asleep.
However, the gentlewoman puts an end to the doctor's doubt by explaining that the candle was standing by her bedside already lit due to her current orders. It is also possible that once the doctor hears Lady Macbeth has been ordering that a lit candle be kept at her bedside, he might have recognized her fear of the dark and added her fear in his mind to the list of Lady Macbeth's symptoms showing she has a very troubled soul and mind, troubled to the extent she has gone mad. The reader knows from earlier scenes that Lady Macbeth's fear of the dark connects to the guilt she feels for having conspired to murder King Duncan in his sleep at night, as we see from her earlier lines: "Come, thick night, and pall the in the dunnest smoke of hell, that my keen knife see not the wound it makes, nor heaven peep through the blanket of the dark" (I.v.57-60).
Hence, the doctor is simply asking about the light because he is trying to disprove or confirm the sleepwalking story. After that point, he may fully see that she is afraid of the dark and connect her fear with the rest of the symptoms showing she has gone mad just as the reader is able to see she has become afraid of the dark and is able to connect her fear with her guilt.