A task's duration (duration: The total span of active working time that is required to complete a task. This is generally the amount of working time from the start to finish of a task, as defined by the project and resource calendar.) changes when you change its start (start date: The date when a task is scheduled to begin. This date is based on the duration, calendars, and constraints of predecessor and successor tasks. A task's start date is also based on its own calendars and constraints.) and finish (finish date: The date that a task is scheduled to be completed. This date is based on the task's start date, duration, calendars, predecessor dates, task dependencies, and constraints.) dates.
If you enter a task's start and finish dates instead of a duration, Project calculates the duration based on the working time (working time: Hours designated in a resource or project calendar during which work can occur.) between those dates. If you later change the start date or finish date (but don't change the duration), the duration is recalculated.
Of a task's duration, start date, and finish date fields, Project tracks the last two fields that were edited and recalculates the earliest edited of those three fields based on the latest field that you changed. So if you enter a start date and then enter a finish date, the duration is calculated. If you then change the duration, the start date is recalculated.
For example, if you enter a start date of May 1 and a finish date of May 4, Project calculates the duration as three days. If you change the finish date to May 5, the duration is recalculated to four days. But if you change the finish date to May 8 instead of editing the duration, Project recalculates the start date to May 4, keeping the duration constant at four days because the last two fields that you changed were for the finish date and duration.
If you must enter start and finish dates, and if you want the duration to remain constant, make sure the new start and finish dates represent the same number of working days as the previous dates. The duration will remain the same as before.