When I found Thundurus he fled. Have I done something wrong?
It's normal for them fleed from battle, those Pokémon are called Roaming Pokémon. You can see more here about the Roaming Pokémons.
If you want them to don't fleed, use a Pokemon faster than Thundurus with a trapping move such as Mean Look or Wrap, or send out a Pokémon with a trapping Ability such as Shadow Tag or Arena Trap (several roaming Pokémon are Flying-type or have the Ability Levitate, rendering Arena Trap ineffective against them).Arena Trap won't work because Thundurus is a flying Pokémon.
Hope this helps.