If you Google Nexus 5x lag, you will see many users complaining about lag on the Nexus 5x. If you follow the threads, some people will complain about lag. Others will say they've experienced no lag. Some seem to think it has to do with faulty units (vs. non-faulty units). Others seem to think it has to do with not-yet-optimized-for-Marshmallow apps.
I, too, experienced the lag, but I chalked it up to Marshmallow still needing some kinks ironed out or the difference in performance between an encrypted Android vs. an unencrypted one. It also wasn't horribly debilitating a lag—it was just slightly annoying. It would be an extra second switching apps or an extra second for an app to load after being selected.
I tried uninstalling some apps I thought might be problematic. I also tried clearing the cache partition (that would make things a little better for maybe an hour or so, but then the lag would return).
Finally, I did what I really didn't want to do: I did a factory reset. I backed up all my data to my computer and did a full wipe of all my phone's contents. Now this, I think, is the most important step: when setting up the phone, I chose not to restore backed up data from Google's servers and just do a fresh, clean setup. It was annoying, of course, because I had to go through all my settings and tweak them and manually download all my apps again, but it was totally worth it. Now there's absolutely zero lag. The phone performs just as well as my old Moto X 2013.
I don't know that this is the definitive solution, but it worked for me. So if you're one of those Nexus 5x users who's experiencing the dreaded lag, take the 3-4 hours to back up your data locally, do a factory reset, do not restore backed-up data associated with your Google account, then re-download your apps, restore your local backup, and re-configure everything again fresh. You, too, may find it totally worth the trouble.