Pasta being boiled.
Here's How Long Cooked Pasta Lasts In The Fridge

If you find a container of noodles in the back of the fridge, know that cooked pasta will only last about three to five days in the fridge, and only if you store it properly.

An airtight container prevents smells from seeping into the pasta. Store the noodles after they’ve been cooled, as heat trapped in the container could cause condensation to form.

Pasta will start to change color as it gets older. A darker shade, mold spots, or slimy texture are an obvious sign that it's gone bad.

Bacteria growth can also cause pasta to take on a foul smell. If you suspect that your leftovers are past their prime, it's probably best to just toss the whole thing in the trash.