I want to install a 220 heater in my garage.
You need 8AWG and a 40A breaker for this equipment

You'll need to run 8AWG for this circuit -- NEC 424.3(B) requires the 125% continuous load modifier to be applied to the nameplate rating of the heater, meaning you need to size the wire and breaker for 38.75A of load.

Two hots and a ground should be fine

Most electric heating equipment runs solely off 240VAC, which means that you only need to provide it with two hots and a ground, unless the equipment installation instructions specify a neutral is required as well.  In that case, you'll need to use 8/3 cable for this; otherwise, 8/2 is OK here, given that nothing else can be attached to this circuit anyway.