I just bought a Nexus 5 today (Feb 15 2017). The device comes with KitKat OS. I read that Google ended all updates for Nexus 5. Will my phone get Marshmallow update automatically ?
Go to Settings, About Phone, Software Update, and check for updates. You'll probably receive a sequence of them, until you receive the latest version. It's usually best done over wifi, if only to avoid mobile data charges.
I recommend registering as a member so that you can post in the Nexus 5 forum for other tips about that excellent device.