How does a computer play chess?
The computer looks at each possible move, and calculates the consequences of each possible move, based on the current game state and the rules of chess. It then selects the move that it believes will give it the best chance of winning the game.
How can I beat a computer at chess?
The only way to beat a computer at chess is to find a move that the computer is not able to calculate, or to find a move that the computer is not able to defend against.