Carbon monoxide (CO) produced in many large-scale industrial oxidation processes is difficult to separate from nitrogen (N2), and afterward, CO is further oxidized to carbon dioxide. Here, we report a soft nanoporous crystalline material that selectively adsorbs CO with adaptable pores, and we present crystallographic evidence that CO molecules can coordinate with copper(II) ions. The unprecedented high selectivity was achieved by the synergetic effect of the local interaction between CO and accessible metal sites and a global transformation of the framework. This transformable crystalline material realized the separation of CO from mixtures with N2, a gas that is the most competitive to CO. The dynamic and efficient molecular trapping and releasing system is reminiscent of sophisticated biological systems such as heme proteins.