How do genes affect animal behavior?
Due to evolutionary reasons.
Due to evolution those animals who carried genes that caused them to survive passed on their genes and those behaviors triggered by their genes just started passing on to next generations. Now, consider a gene that is responsible for short limbs in dogs, start to occur in some dogs due to whatever reason, those dogs that are affected by this gene cannot hunt anymore because they cannot chase their "food," so they will die. Now, this "short limb" gene affected the process through which the dog would hunt, so the dog cannot hunt anymore and that is an influence of a gene on behavior.