The reason is that the aircraft has filed a route along airways and not a direct (great circle) route. In most countries, an IFR flight cannot just file a direct route and they have to use airways. An exception would be countries with Free Route Airspace.
The flight you show looks like AA747 from 26 Jun 2021 on FlightAware. If you follow that link, it will show you the route they filed on the right:
SSOXS5 SSOXS BUZRD SEY HTO RIFLE J174 ORF J121 CHS CAKET Q97 JEVED Q97 KENLL OMN HILEY7
Here, SSOXS5 is the SID and HILEY7 is the STAR. Everything in between is the filed route. You can type the same route into SkyVector to view it on a map of high altitude airways:
There are no airways that would be a direct (great circle) route from Boston to Miami, so the reason they don't go over the water during the first half of the route is simply that there are no suitable airways.
During the second half of the route, the situation is a bit different. There are some airways over water that would provide a more direct route. If you look at the route they flew the next day on FlightAware, then you can see that they used these airways:
You can also see that the flight on 26 Jun deviated from the planed route (the kink in South Carolina). The reason for not using the shorter airways and for this kink is likely the presence of thunderstorms along the route. You can see them on your FlightAware screenshot as the yellow and red patches. The flight crew probably asked for a different route for weather avoidance. Here is a zoom of the region, where they deviated from the route:
You can clearly see the single thunderstorm cell directly in front of the original route.