Polymer nanofibers with high thermal conductivities and outstanding thermal stabilities are highly desirable in heat transfer-critical applications such as thermal management, heat exchangers and energy storage. In this work, we unlock the fundamental relations between the thermal conductivity and thermal stability of polymer nanofibers and their molecular characteristics by studying the temperature-induced phase transitions and thermal transport of a series of polymer nanofibers. Ten different polymer nanofibers with systematically chosen molecular structures are studied using large scale molecular dynamics simulations. We found that high thermal conductivity and good thermal stability can be achieved in polymers with rigid backbones, exemplified by π-conjugated polymers, due to suppressed segmental rotations and large phonon group velocities. The low probability of segmental rotation does 2 not only prevent temperature-induced phase transition but also enables long phonon mean free paths due to reduced disorder scattering. Although stronger inter-chain interactions can also improve the thermal stability, polymers with such a feature usually have heavier atoms, weaker backbone bonds, and segments vulnerable to random rotations, which lead to low thermal conductivities. This work elucidates the underlying linkage between the molecular nature and macroscopic thermal properties of polymer nanofibers, which is instrumental to the design of thermally conductive polymer nanofibers with high temperature stabilities.