A task's duration changes when you change its start and finish dates.
If you enter a task's start and finish dates instead of a duration, Project calculates the duration based on the working time 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.