A man may not have sexual relations with an animal, in either an active or a passive capacity. To do so is a gross misuse of one’s reproductive capacity. The Torah tells us in the very first chapter of Genesis that living things are only meant to mate and reproduce with their own kind (see Genesis 1:11). Rashi on parshas Noach (Gen. 7:20) references Talmud Sanhedrin 108b that “all flesh” of the flood generation was corrupt – even the animals engaged in sexual relations outide of their species, for which they were wiped out alongside the corrupt people.
We will see in future mitzvos prohibitions against crossbreeding (Mitzvah #244), against mixing different plants together (Mitzvah #245), against combining wool (which comes from an animal) with linen (which comes from a plant) in a single garment (Mitzvah #551), and even against pulling a plow using two different species of animal (Mitzvah #550). Clearly, each of God’s creations has a unique role and He doesn’t want us blurring those lines. After seeing the sexual relationships with people in which He doesn’t want us to participate, it’s a “no-brainer” that carnal intimacy with an animal goes against His plan for the world.
This mitzvah applies regardless of whether the animal is a male or a female and regardless of whether the man played the active role or the passive role.
In Leviticus 20:15, we see that if a person does engage in bestiality, both he and the animal are executed. The obvious question is why the animal should be executed – if anything, it was a victim in the act! The Talmud in Sanhedrin (54a) explains that it is out of respect for the person. It would be a source of derision that people would inevitably refer to the animal by saying things like “Look! There’s the dog that Mr. Jones married!” or similar such phrases. Even though the person committed an unnatural act, he still deserves human dignity.
This mitzvah applies in all times and places. It is discussed in the Talmud in tractate Sanhedrin on pages 54a-b. It is codified in the Shulchan Aruch in Even Ha’Ezer 24. This prohibition is #348 of the 365 negative mitzvos in the Rambam’s Sefer HaMitzvos and #117 of the 194 negative mitzvos that can be fulfilled today as listed in the Sefer HaMitzvos HaKatzar of the Chofetz Chaim.