Change in the chemical composition of infalling gas forming a disk around a protostar