how far should a dynamic mic be placed away from a guitar amp for recording?

It depends what kind of sound you want. You could put it right infront of the speaker, you could put it a foot away from the speaker or at a 45 degree angle to it. It's up to you.
2 - 12 inches kinda thing.... Close anyway. I usually have it right up close to the grill cloth. Things to take into consideration are, I have heard the closer you put the mic the more bass you get (called something like proximity effect) and also the further away the more natural reveb you will get from the room.
Place it where it sounds good.

But generally, the mic should be placed right up on the grill. This will usually give you a sound that's almost identicle to what you hear coming out of the amp, but you also have to consider mic placement around the speaker cone.

If the mic is pointed at the center of the speaker cone, you'll get a more trebly sound. The farther you move the mic away from the center of the cone, the more bassy your sound will be. Most people like to put the mic about half way toward the center of the cone, but you could do whatever you want; you don't even have to have the mic in front of any of the speaker cones.

Also, something that people will do is mic the back of the amp (if you have an open back amp). This usually provides a lot more low end. Also, you could use ambient micing by bringing the mic farther away from the cabinet, You'll notice that you get completely different sounds every inch or two you move the mic away from the amp. And if you want to get a really extreme ambien sound then you could mic the room, but you'll probably want a condensor for this.
And of course you could blend the sounds if you use two mics, or if you record direct.

But, generally I just stick my 57 right up to the grill (touching it). This usually gives a really up front, in-your-face kind of guitar sound.
Just experiment and see what happens.