Star formation, which is initiated by the gravitational collapse of cold and dense cores, is associated with energetic activities such as infall, accretion, jets, and outflows. These dynamical processes produce (radiation and/or shock) energy to affect the physical and chemical conditions of the associated material. In particular, the accretion of matter to the central protostar has a prime impact on the temperature structures of the disk and the inner envelope in a young stellar object, resulting in inevitable alterations of their chemical distribution. Therefore, depending on the accretion mechanism, the chemical evolution can be very different in the inner structures related to star formation (i.e., disk and inner envelope), which set the initial conditions of planet formation. I will review how the chemistry evolves during star formation, depending on various parameters such as the timescale and temperature of the prestellar cores before the collapse, and how the observations of various chemical species can contribute to our understanding of dynamical and chemical processes in star and planet formation.