Why is a rainbow curved?

That’s a portion of a halo, not a rainbow. They look similar, but they have very different causes.

What you probably saw was a sundog. Sundogs are caused by light refracting through hexagonal ice crystals*. Because they are oriented by their shape as they fall through the atmosphere, the light is concentrated at points on either side of the sun, rather than forming a complete “halo” around the sun **. If the crystals are large enough, you get that prismatic separation of light, with red on the side towards the sun. Smaller crystals spread the colors out, so that you might get only a red tinge on the inside, or no color separation at all. If the crystals aren’t completely oriented, you get them forming portions of the “halo”, which people perceive as straight segments.
*Properly, a halo around the sun is caused by spherical droplets, through which the light refractgs twice, but does not reflect, as in a rainbow. But you can get ice crystal “haloes” around the sun, as well, which I here put quotes around, to distiunguish them.

**You can, indeed, get a full ice crystal “halo” around the sun, at a different angular separation than a raindrop or mist halo. They’re much less common than sundogs, however, which are actually even more common than rainbows, but nobody notices them. To form an ice crystal “halo” requires the crystals to be randomly oriented, and they usually tend to fall in an oriented configuration.

Yup, looking at pics online, it was a sun dog. Good call!