how do grandmasters calculate so many moves ahead



not nearly as much as you think. Grandmasters verify/falsify what their exceptional intuition tells them through calculation, but this idea they see 10 moves ahead all the time is a myth. They can calculate that far, and more importantly ,with branching (10 moves ahead isnt so bad, having a main line 7 moves deep, with 3 branches, each 3-5 moves is much harder and within their skillset if given enough time)

GM Kotov wrote a book called Think Like a Grandmaster. In it he described the concept of candidate moves… a move that looks feasible and needs more analysis. He’s not the first to use it, however, he was the first to formally write about it.
You might find candidate moves by evaluating checks, captures and threats. As you get more experienced you may be able to recognize common patterns in a position. I also like IM Silman’s book How to Reassess Your Chess. In it he discusses chess imbalances. This can help you select candidate moves.
in short, players will not brute force all possible moves. Rather, they will narrow the feasible moves and start evaluating each. CM Kabadayi talks about 3-ply calculations… 3 half moves. This isn’t too deep and something most players should be able to do to create happy pieces.

As one improves at chess you sort of see the board differently. It stops being a bunch of individual pieces, and you see the board in ... clumps might be a good word? Things like "castled king" but are the pawns all on their home squares? Is the rook pawn advanced one? Is there a knight on KB3 (f6 or f3), or maybe just a move away from defending a particular pawn you're thinking of attacking? Is there a Bishop on a long diagonal? They are less likely to "forget about the sniper" way in the corner as they see the board in a way such that th diagonal is controlled rathe than having to remember "there's a Bishop on b2, and it controls ....". Because of how the board is viewed in these clumps, it is easier to hold it in memory. Just like it's easier to hold all the letters for "Keep King safety in mind" than it is "Axxd Amae ltoxru me bmeq" even though the 2nd is just a letter substitution of the first (so same information, but you can't clump it into words).
As a result, GM are able to cull out a lot more moves, they don't consider lines that you or I would so their calculations deal with fewer possibilities. Even then, as darkunorthodox88 says, they don't calculate 10 moves deep every move, rather, for most positions they only need to calculate a few moves ahead on the couple of lines worth considering to see which is the better one. When it gets complicated, and there are lots of options, or the positions complex, they can take 20 or 30 minutes to work it out because then they have to go through all the branches. Due to their practice, and the skills they have gained, they are good at just getting down to it and methodically working through things, registering the result, so they can in the end make their choice. And still, in complex positions, they will still sometimes make mistakes.
GM Simon Willimans (GingerGM) posts on YouTube his Titled Tuesday runs, and occasionally some other bits, where he talks through his thought processes. He's forever pointing out he's only really looking 3 to 5 moves ahead most of the time, but because he's so familiar with the plans and ideas of the middle games, he knows what he's trying to do (i.e. I need to find a way to lock that Bishop away, because then my opponent is effectively down a piece). He's not so much looking at individual moves at first, but working out what the moves have to achieve given the "clump" on the board that contains his opponent's Bishop (often a fianchettoed one in this example). Then he looks at moves that might work towards that end, hence a random pawn move on the other side of the board is likely not something he would consider because he see's an idea given that "clump" of pieces. For someone starting out who doesn't understand those sorts of "plans", they might have no idea what to do so they move a pawn because they have to move something - they've been looking at all the individual pieces because that's how they see the board.
And yes, it takes time and practice and a lot of heartbreak to develop that sort of clumpy vision, but that's the beauty of chess. The more you play, the more you see, and the better the overall picture gets.
Hmmm, that went on a bit too long.

Yeah thanks, I was curious about this because I've seen interviews of grandmasters. One of them was Vishy Anand he told he can calculate 76 moves ahead that is just mind blowing

The main difference between a Grandmaster and a weaker player is NOT how many moves ahead a Grandmaster looks. In fact, that is a result, not a cause.
The main difference is WHICH moves a Grandmaster chooses to examine more closely. An amateur will waste their thinking time looking at irrelevant moves that cannot really be profitably calculated anyway because they don't force the opponent's reply.
When asked how many moves he usually looked ahead, Richard Reti answered "As a rule, not a single one."
In the mid-1900s, a Dutch psychologist conducted a study in which he showed game positions to chessplayers of various strengths and had then analyze the position while talking aloud.
One of the interesting findings was that chess masters did NOT look more moves ahead than players of lesser strength. Instead, the moves they considered were simply stronger than those considered by others.
How did they do this? They identified the key aspects of the position more quickly and more accurately than other players.
How did they do this? As a previous poster said, chess masters have acquired a large store of positions (pawn structures, piece configurations, etc.) that enable them to understand the key elements of a position.
Practice more than anything and intuition
In the mid-1900s, a Dutch psychologist conducted a study in which he showed game positions to chessplayers of various strengths and had then analyze the position while talking aloud.
One of the interesting findings was that chess masters did NOT look more moves ahead than players of lesser strength. Instead, the moves they considered were simply stronger than those considered by others.
How did they do this? They identified the key aspects of the position more quickly and more accurately than other players.
How did they do this? As a previous poster said, chess masters have acquired a large store of positions (pawn structures, piece configurations, etc.) that enable them to understand the key elements of a position.
I did notice that around 800 (from people I know ) people calculate but it's not a solid thought process like if I move here it opens up the king . Theres not really an idea behind it more like "me see free stuff or fork " but in 2000 ish if there's solid calculations (mainly positionally ) you can probably assume they are 2000 at least I honestly didn't get positional play until then anyway