The great spider that attacks Frodo and Sam in J.R.R. Tolkien’s legendarium is Shelob.
Shelob lives in the pass above Cirith Ungol, on the route Frodo and Sam take toward Mordor. She is described as an ancient creature descended from Ungoliant, the enormous spider-like being who appears in the First Age stories. Unlike ordinary giant spiders, Shelob is presented as a singular and especially powerful monster.
Shelob bites Frodo and paralyses him with her venom, but Samwise Gamgee believes Frodo has been killed and takes up the sword Sting. Sam wounds Shelob and drives her away, then uses the Phial of Galadriel to resist her darkness.
Shelob is not the same character as Ungoliant. Ungoliant belongs to the mythology of the Silmarils and is vastly older in the chronology. The giant spiders of Mirkwood are also separate creatures, though Tolkien links them through inherited ancestry and recurring spider imagery.