Hulk explains it in the movie - he states that you cannot change your past. You can jump into the past (which is effectively your future at that point) and in doing so, you create a new branch of reality (as per the Ancient One, explaining to Hulk). Every time one of the team appears in the past, they branch off the "original" timestream at that point, creating a new reality.
This is why time travel and changing the past does not affect the present time when you come back. There is a whole new reality following forward from the point you visited/changed, and you return to your own time, with the past you experienced completely intact.
These branched timelines will continue on unless they are collapsed back into the "original" timeline, which is the goal in the end where the various stones are returned to their original points, as if they never left.
Cap going back and marrying Peggy is the exception - he left and returned all the stones, thus closing off all the branched timelines (presumably except the 2012 one where Loki pinched the Tesseract and disappeared, probably into a Disney+ TV series) and then he created an alternate timeline where he went to the 40s and stayed there with Peggy. He lived there from that point until he came back to the "main/original" timeline to hand over the shield to Sam.
Time travel is hard and makes your head hurt, but this is as clear as I can understand it!