We are told absolutely nothing about the widow’s motivations in this instance. Therefore, all we can do is speculate about why a very poor person would give so much of her money as an offering.
The most likely explanation is that the widow realized that, in some ways, she had much to be grateful for and that other people had it worse than she did. As a poor person, she probably lived among other poor people and would have some idea as to what other people’s lives were like. Also, she might have realized that her life wasn’t that bad even if she was poor. She might have been grateful for the fact that she had her health. She might have been grateful because she had children and grandchildren who were also healthy. Perhaps she realized that happiness was more important than money.
People can and should be grateful for things other than their financial circumstances. It is most likely that the widow realized this and decided that God had blessed her in many ways that had nothing to do with money. She wanted to give thanks in a way that showed God that she was truly grateful.