Three things: Rotom-Wash, Heatran and Rock types. These are the top three best counters to Talonflame in my opinion, for one big reason: they wall Talonflame's STAB. If you don't know what that means since you're new, you'll see a lot of this abbreviation, specifically if you play competitive Pokemon. It stands for Same Type Attack Bonus, which refers to the 1.5x power boost a move gets if its type matches one of its user's types.
So how can you counter Talonflame with these Pokemon?
- Rotom-Wash: It's the best Rotom form and has been for a long time, and it got even better after X and Y were released as it became one of the few good Pokemon that could completely wall Talonflame's best moves Flare Blitz and Brave Bird. Rotom-Wash can survive a hit from even a Talonflame with a boost in attack from Swords Dance and kill it in return (though Choice Band versions are more common and arguably better). use Volt Switch to kill it, even with 70 power it'll KO, and it will allow you to switch to something else which can control what your opponent brings out next, giving you the power to change the battle.
Rotom-Heat can do a similarly good job, but it has much more weaknesses and a problem with Stealth Rock, which makes Rotom-Wash better in general.
- Heatran: It's good for a similar reason to Rotom-Wash: Talonflame cannot touch it. At all. Heatran turns Flare Blitz into a Fire attack boost with its ability Flash Fire, and Brave Bird is walled by its Steel typing. All it can really do it use U-Turn to get out (which is x4 resisted so it'll do borderline nothing). If it happens to stay in, spam attacks on it until it dies, or use Roar to force it out of the field.
- Rock-types: The most simple way to stop Talonfalme is with a good Rock type with a decent Defence stat. The best one of these is Tyranitar, who has colossal Defence (specifically in Mega form although Assault Vest is preferable in my opinion). They can KO Talonflame with Stone Edge while taking little damage from other moves. Tyranitar won't like a U-Turn, but given that around a third of Talonflame use Choice Band, they'll be locked into a resisted ("not very effective") move and be forced to switch out normally.
The mere existence of these Pokemon will mean experienced players won't attempt to sweep with Talonflame since they know that they won't win a fight against them with Talonflame. There are other tricks you can use to beat it, for example stalling it out using its recoil moves to your advantage, or "out-prioritising" it by using a +2 priority move like Extreme Speed to move before it does and deal and nice chunk of damage to it. Perhaps the best way to counter Talonflame outside of a Pokemon is Stealth Rock. In case you didn't know, Stealth Rock deals damage to every Pokemon your opponent switches in, according to their type match with Rock. Since Talonflame is 4x weak to Rock, it will lose a huge 50% from its HP when switching in, which softens it up a lot, leaving it vulnerable to nearly any attack or simply killing itself with the recoil from Flare Blitz or Brave Bird.
Really all you have to do it survive an attack and hit it with something with a decent amount of power, and Talonflame is gone. If the move and the Pokemon are powerful enough, often it won't even need to be super effective; Talonflame is just so frail. The Pokemon and things I mentioned are just the best at doing that, there are many other ways to counter it that depend on the situation. Also note that if those Pokemon are weakened, they may still lose against Talonflame.
If you have any questions about this, leave a comment. I tried to explain some things that may be foreign to newer players, but if I didn't do a good job of something let me know.