A polymer density functional theory has been employed for investigating the structure and phase behaviors of the chain polymer, which is modelled as the tangentially connected sphere chain with an attractive interaction, inside the nanosized pores. The excess free energy of the chain polymer has been approximated as the modified fundamental measure-theory for the hard spheres, the Wertheim's first-order perturbation for the chain connectivity, and the mean-field approximation for the van der Waals contribution. For the value of the chemical potential corresponding to a stable liquid phase in the bulk system and a metastable vapor phase, the flexible chain molecules undergo the liquid-vapor transition as the pore size is reduced; the vapor is the stable phase at small volume, whereas the liquid is the stable phase at large volume. The wide liquid-vapor coexistence curve, which explains the wide range of metastable liquid-vapor states, is observed at low temperature. The increase of temperature and decrease of pore size result in a narrowing of liquid-vapor coexistence curves. The increase of chain length leads to a shift of the liquid-vapor coexistence curve towards lower values of chemical potential. The coexistence curves for the confined phase diagram are contained within the corresponding bulk liquid-vapor coexistence curve. The equilibrium capillary phase transition occurs at a higher chemical potential than in the bulk phase.