Without delving too deep into architectural details, AMD's K8 (Opteron/Athlon64) architecture has a shorter pipeline than Intel's P4 architecture.
As an analogy imagine Widget Inc. hires workers for an assembly line: they choose to split the task of building their widgets into 12 parts. As a result, they can be working on up to six widgets at once; let's assume that each Widget Inc. task takes 1 minute to complete for each worker. We now see that widget inc. can get one widget out the door every minute.
It's competitor ACME corp. has instead chosen to break the task of building widgets into 30 (smaller) tasks instead of 12. As a result, instead of working in one minute task, each of the workers can complete his task in only 30 seconds! ACME inc. can now work on up to 30 widgets at once and can complete a widget every 30 seconds!
This looks like ACME corp. has a big advantage over Widget inc., right? Well it turns out that these widgets aren't always that simple or identical; once in awhile you need to finish the widget before you can tell how to build the next one. What happens then?
Well, if that happens, Widget inc.'s assembly worker #1 has to wait 5 minutes after finishing widget#1 before he can build widget#2. As a result, there was a waste of time each worker on the assembly line had to wait for widget#1 to finish and wasted precious time. In fact, each worker wasted 5 minutes between his work on widget#1 and widget#2, so a total of 6*5 = 30 man-minutes were wasted.
For ACME corp on the other hand things are much worse! if this happen, each of the 30 workers wastes 15 minutes between his pieces. As a result 30*15 minutes = 450 man-minutes were wasted!
So Widget inc.'s workers, though slower were more efficient in this second case. This situation I just described is a huge simplification of what happens but it describes what is known as a pipeline stall. Essentially games often contain code that looks to processor like the second code, so AMD's shorter pipeline is better for it even if it has a lower frequency. Media applications, on the other hand resemble the first situation, and in that case Intel's long pipeline and high frequency allow it to work faster on that kind of data.
In short, that's why AMD's processors are faster for games and Intel's are faster at encoding. Again, realize this is a very simplified analogy and that in the real world things are much more complicated and much messier.
edit: oops, I fixed some sketchy math, I had in there.