The International Residential Code, the most widely adopted building code in the U.S., does not require that detached garages be provided with electricity. However, the code does set forth certain requirements for detached garages that are provided with electricity. Keep in mind that codes vary from jurisdiction to jurisdiction, and these are minimums only.
Detached garages that are provided with electricity must have at least one interior light, and this interior light must be controlled by a wall switch. A lighted garage door opener may not be used to satisfy this requirement, even if the light is controlled by its own switch.
Detached garages with electricity must have a light outside each grade level egress door, and this light must be controlled by a wall switch or motion sensor. The code does not consider the vehicle door to be an egress door.
Those detached garages with electricity must have at least one electrical outlet. There are no restrictions on where the outlet or outlets may be placed.
Electrical outlets in detached garages must be protected by a ground fault circuit interrupter (GFCI).