As long as you download games from reputable sources, playing on your computer is generally safe. Trusted platforms like Steam greatly reduce the risk of harmful files.
Sticking to well-known storefronts and avoiding shady downloads is the best way to protect your machine.