Are nitrofurantoin and trimethoprim the same?

No. They both work completely differently - trimethoprim is an antibiotic and nitrofurantoin is something that works more simply, such that we call it a urinary antiseptic.
No. They are two completely different antibiotics. Like apples and oranges are both fruits but not the same.