Robert's brother Stannis, whom he left to hold Storm's End, warned him that marching west into enemy territory would overextend himself, and instead he should immediately march north to join his allies from the Vale and the North, but Robert wouldn't listen, hoping for a quick victory.
Ashford was an indecisive battle, in which Robert Baratheon was defeated by the vanguard of House Tyrell, led by Randyll Tarly. However, Robert's army was able to retreat in good order, before the main force of the Tyrell army could arrive to crush him. Lord Mace Tyrell's main army only arrived after Robert had already retreated.
The defeat forced Robert's army to flee north, to link up with the rebel armies from the North and the Vale. This left the Stormlands open to be invaded by the loyalist armies of the Reach and left Storm's End free for the Tyrells to besiege. The Tyrells could have chased after Robert, but Mace assumed that Tywin Lannister would stay loyal and flank Robert's army as it passed the Westerlands. Meanwhile, if the Tyrells could successfully take Robert's home castle of Storm's End, it would be a crushing blow to rebel morale, which would lead to Robert's supporters abandoning him.
Years later, Stannis Baratheon encountered Samwell Tarly at the Wall and was surprised he is Randyll Tarly's son. Stannis recounts to Sam how Randyll defeated Robert in the Battle of Ashford, the only battle Robert ever lost.
In the booksEdit
In the Season 2 Histories & Lore featurettes, Margaery Tyrell says it was her father Mace Tyrell's victory, with no mention of Tarly - which is unsurprising, given that this is the version her own father likes to tell. The Tyrells are quite proud of the fact that they inflicted the only defeat Robert suffered in the entire war. Moreover, Mace (and the other Tyrells) like to remember it as a crushing and decisive rout of Robert's army, when really the battle was at best indecisive, and Robert's army was not routed but withdrew in good order to the north. Tarly's forces were just the vanguard of the main Tyrell force commanded by Mace, and Robert withdrew before even having to face Mace and his main army (thus while Tarly certainly performed quite well, the choice to withdraw was actually Robert's, because he knew he couldn't hold the position once Tyrell reinforcements arrived).
Indeed, in the subsequent Season 3 Histories & Lore featurette on the Reach, Margaery (again narrating) grudgingly admits that it was actually her father's vanguard who won the battle, and that Robert retreated before Mace himself actually arrived. Stannis himself later confirmed on-screen in Season 5's "Kill the Boy" that it was actually Randyll Tarly who defeated Robert at the Battle of Ashford, crediting him without mentioning Mace Tyrell at all.
Wildfire plot · Sack of King's Landing · Siege of Storm's End