When breeding, it tends to work by 'slot'. However the 'slots' only tend to come into play when the hatched pokemons abilities differ from their more evolved parents (Nincada's 'slot1' Compound Eyes becomes Ninjask's 'slot1' Speed Boost). In any breeding pair where a ditto is not present, it is only the female that passes down their ability. If we look at your proposed situation:
Slot1 | Slot2 | Hidden Ability
Ninjask: Speed Boost | N/A | Infiltrator
Venipede: Poison Point | Swarm | Speed Boost
- A female Ninjask (Or a male if bred with a Ditto) with Speed Boost will always pass down the slot 1 ability (Which would be Compound Eyes on the hatched Nincada).
- A female Ninjask with Infiltrator will have an 80% to pass down the hidden ability (Nincada hatches with Run Away). The remaining 20% would get the slot1 ability.
- A male Ninjask with Infiltrator has a 20% chance to pass it down if bred with a Ditto (The remaining 80% would get the slot1).
- A female Venipede with Poison Point will pass down the slot1 ability 80% of the time (the remaining 20% would hatch with slot2).
- A female Venipede with Swarm will pass down the slot2 ability 80% of the time (the remaining 20% would hatch with slot1).
- A female Venipede with Speed Boost will have an 80% chance to pass down the hidden ability. The remainder would be divided equally (10% slot1, 10% slot2).
- A male Venipede with Poison Point or Swarm when bred with a Ditto has a 50% chance to for the egg to hatch with a slot1 ability, and 50% chance for slot2
- A male Venipede with Speed Boost has a 20% chance to pass it down if bred with a Ditto. The remainder would be divided equally (40% slot1, 40% slot2).
At no point in the various pairings does the male have much say in what ability gets passed down (unless the male (or genderless) is bred with a Ditto) it does not matter if the male has a hidden ability, or an ability that matches the name of one of the female's abilities.
For further reading, you can look up breeding on Serebii (scroll down to the "Standard Abilities" and "Hidden Abilities" headings) or on Bulbapedia.