Rhaenys is related to Daenerys Targaryen through a long line. In particular, she is her seventh cousin six times removed (we think, because the Targaryen family tree is hard to understand).
Rhaenys is not Daenerys's direct ancestor, though Rhaeynra Targaryen is. When Rhaenys's children Laena and Laenor died, her line of Targaryens came to an end (well, Laenor faked his death).
Rhaenys had grandchildren, but they were all killed in the Dance of the Dragons. If they had lived, they would have sat on the Iron Throne and maybe saved us from the Mad King by starting a new line of kings.
If you want to know more about Daemon Targaryen, Larys Strong, Aegon II Targaryen, and Ser Criston Cole, we have guides for them as well.