Welcome to Android Central! The Nexus 5 is almost EIGHT years old, so it's not surprising for the battery to deteriorate over that time, even with careful usage. In addition, that phone was never known for good battery life (I had it, and I recall the best I could ever get was maybe 4 hours of screen on time, if I was lucky). It's a 2300 mAh battery, which is laughably tiny by today's standards.
If you want to keep using the phone, bring it to a repair shop to get the battery replaced. But I would strongly recommend upgrading to a more modern phone, since the Nexus 5 stopped getting updates after Marshmallow, so there may be quite a few security vulnerabilities that were never patched. You may want to consider the Nexus 5's spiritual successors, the Pixel 3a or 4a.