Travelling by sea has advantages. Its significantly faster than walking and your army arrives more rested and able to fight than one that has walked. I'm not saying that this journey would be faster than walking, given the distance is much longer, but it might not be as much different as the map would indicate.
It's also the case that King's Landing is the capital city of the Seven Kingdoms. There is a fairly direct route between it and Highgarden. Dragonstone is on an island and has indirect routes to Casterly Rock - particularly if you are avoiding going via King's Landing.
Daenerys is also the 'foreign invader', and may not want to stoke more resentment than necessary or invite any ambushes by marching an army via Harrenhal and Riverrun.