I think he went into the future because
A) he knows he dies and wants to correct that, if he stays in his time eventually he will get killed. Lets just pretend Thanos doesn't know all these arbitrary rules that they set up. To him its just the future and in the future he dies.
B)all the stones are there. He doesn't have to go around collecting them, the Avengers in the future already did that for him, and lucky for him even built him a gauntlet so he didn't have to chop off midget giant mans hands.
C)The plot called for it. Russo's shook us with killing Thanos in the first few minutes, but needed a way to bring him back for the final battle. Like most of Endgame Russo's wrote themeselve into a corner for shock value and used time travel to get themselves out of the hole.
The movie is nonsense, but you have to turn your brain off. In the end its worth it for Cap and Tony's end of a 22 movie journey. The final battle, cap with the Hammer, Avengers Assemble, I am Iron Man, all of this makes the nonsense of the plot worth it. Just don't think about it too much and accept the time travel and comic book logic of the movie and go with it. It hits the right emotional beats and throws in enough fan service and nods and has a satisfying and logical ending that the ride is worth it. IW was still the better movie.
I actually think if you had IW up until Thanos on Titan fight, then picked up Endgame after all the time travel stuff and went into the final fight and ending of Endgame that would be the perfect movie.