Avengers 4 title Avengers: Endgame was a long kept secret and it was said it can spoil the Infinity Wars:
But how? How come this title was so big deal? Is this title have anything to do with some comic-book reference?
"Endgame" isn't a reference to the comics, but to Infinity War. Specifically, Dr. Strange's remark upon surrendering the Time Stone:
We're in the endgame now.
This line - and his parting remark, "This was the only way" - were taken as indications that his actions throughout Infinity War, including surrendering the Time Stone, were all part of a complex long-term gambit to achieve the one timeline where Thanos is defeated. The fact it's now the title of the sequel would appear to confirm that theory.
In chess the endgame is considered a phase of the game where it can be important to sacrifice a powerful piece in order to win the game. Many see that as an indication that while we might see a victory for our Marvel heroes, they might need to buy that with some true lasting sacrifices, e.g. loss/deaths of characters that won't be undone.
There's also some other associations with a chess endgame: