The motor turns an axle, on which a gear is attached (partially hidden black disk in the picture).
The first two gears shift the rotation out in front of the motor.
The next two knob wheel "gears" turn the rotation 90 degrees, resulting in the golf club motion you see in the picture.
Increase the speed of the golf club:
When you combine gears of different sizes you can change how fast or how strong the output is.
The first two gears have 36 teeth and 12 teeth, in that order. This makes the golf club move 3 times faster than the motor.
If you were to swap the gears, putting the small 12 before the 36, it would make the club 3 times slower than the motor.
You can find building instructions here. This model was designed to be built with the NXT Education Base Set. If you have the normal NXT retail set, you won't be able to follow the instructions exactly; there will be a few missing pieces, but it should still be pretty easy to find suitable replacement parts from what you have in the kit.