This randomized phase II trial studies how well azacitidine and entinostat before chemotherapy works in treating patients with non-small cell lung cancer that has spread to other places in the body. Drugs used in chemotherapy, such as azacitidine, irinotecan hydrochloride, gemcitabine hydrochloride, docetaxel, and pemetrexed disodium, work in different ways to stop the growth of tumor cells, either by killing the cells, by stopping them from dividing, or by stopping them from spreading. Entinostat may stop the growth of tumor cells by blocking some of the enzymes needed for cell growth. Giving azacitidine and entinostat before chemotherapy may work better in treating patients with non-small cell lung cancer.