In Macbeth, why did Lady Macbeth have anxiety attacks and could not sleep?
Sorry to begin by correcting your question, but Lady Macbeth's problem was not that she could not sleep. Rather she could, but when she did sleep, she would sleepwalk and talk about what she had done. It becomes evident if you have a look at what she says in Act V scene i that her problem is caused by massive guilt about what she has personally done and now what Macbeth, her husband, has gone on to do now that she has pointed him in the right direction of rapacious ambition that will let nothing stand in its way. Consider what she says in this scene to her unknown audience of the Doctor and Gentlewoman:
Out, damned spot! out, I say!--One; two: why, then 'tis time to do't.--Hell is murky.--Fie, my Lord, fie! a soldier and afeard?--What need we fear who knows it, when none can call our power to accompt?-Yet who would have thought the old man to have had so much blood in him?
Notice how her speech starts with trying to rid her hands of the stain of blood after she has taken the dagger and covered the poor henchman with Duncan's blood. It is clear that she is re-living a moment that now is particularly traumatic to her, and the guilt that she is experiencing is particularly evident in the last line, as, in spite of all of her tough talk, the amount of blood that emerges after the deed has been done shocks her.