Because of the shield generators, the imperialImperial fleet could not bombard the rebel base. This leads us to only one option: a ground assault to destroy the shield generators, so that orbital bombardment can happen. The rebels had set up trenches defending the shield generator as they knew that a ground assault was inevitable.
Because of the rebel defenses, an infantry assault with storm troopersstormtroopers is a bad idea. Assaulting a heavily-defended position on foot or with light vehicles is costly in manpower, as well as time-consuming: you have to overwhelm the fortified position, and infantry doesn't cut it. Especially when you have a group of AT-ATs with you. They are heavily-armored and cannot be easily destroyed by your foe. They were able to walk right up to the shield generators, taking minor losses and decimating the rebelRebel defenses, and ultimately destroying the generators. It was the perfect plan. However, they failed to take into consideration the ion cannon. Whether they did not know of it, or they failed to see the risk, it enabled the rebelsRebels to get past the blockade.