Hi,
Of course chess.com has (probably complex) algorithm for calculating every game's accuracy, and it's impossible to know exactly how it's done. It will definitely be a function of how close you were each move to what the engine sees as the 'best' move. If you make a big mistake that changes the evaluation by a lot, that hits your accuracy a lot. If you make the best move, that's 100% accuracy.
Of course this isn't perfect, since the chess.com engine is far from a perfect engine. That's why 'Brilliant' moves exist; those are the ones that the engine didn't recognise as the 'best' move, but after playing it, the engine changes its mind and now believes that move is the new 'best' move.
Hope this helps.
Here's my profile in case you need to check who you're getting advice from: https://www.chess.com/member/ellipsoul
Hello everyone, I just played a very quick game, (5 plays each), we did 2 theorical move, and 3 excellente moves, but at the end of the game the analysis tell me that im 21% accurate and he is like 40, how does the calcul is made ?