I am glad you asked this question because I really like this poem. The reality is that the reader is never given an explanation as to why the woman is under the curse. It simply states:
She knows not what the curse may be,
That's part of the beauty of this particular poem. We don't know why she is cursed, and really, she doesn't know what will happen if she breaks the curse. It only comes about when she sees Lancelot and decides to stare out the windows toward Camelot:
Out flew the web and floated wide-The mirror crack'd from side to side;"The curse is come upon me," cried The Lady of Shalott.
The "spell of the curse" seems to either cause her to weave, or causes her to not want do do anything except things she finds safe, like weaving. It's not really clear. What is clear is that when she stops weaving and starts longing toward Camelot she has somehow "tiggered" the curse, the end result of which is that she dies while trying to float there in her boat.
Here is a link to a wonderful picture of the scene:TheLadyOfShallot
The lady of shalott was cursed by her lover who locked her up in the tower so that no one would take her, he wanted her for himself.