The short answer is no – the heat pump needs fresh air to extract heat from – and it can’t get this fresh air if it’s closed up in your garage.
Air-source heat pumps either need to be positioned outside so that they have access to all the fresh air they need, or they can be positioned inside, but must be ducted (sucking in fresh air from outside through a duct, and expelling fresh air to the outside through a duct too).
Ground and water source heat pumps can be positioned inside (in a garage, basement, store, or plantroom) as they don’t exchange air – they extract heat from the ground or from water.
See also Common heat pump placing mistake: Try breathing with a plastic bag over your head