Hello. I am assuming you're using ArcGIS Pro and have created your network dataset from GTFS data following our tutorial.
What you see is the correct behavior. The LineVariantElements generated from the GTFS To Network Dataset Transit Sources tool are simply straight-line connectors between adjacent stops. They do not follow the streets that the actual buses travel on.
Here is the key info from the tool's documentation: The LineVariantElements features are not intended to represent the actual geographic paths taken by buses, trains, or other public transit vehicles but are instead representative of logical connections in the transit system. LineVariantElements features are not meant to be used for visualization. The Public Transit evaluator in the network dataset will use the public transit schedules to determine the travel time required to traverse a LineVariantElements feature, so its shape and length are irrelevant. However, you can optionally edit the shapes of the LineVariantElements features manually, but do not split or merge the features.
I think it's going to be tough for you to make this work with your flooding polygons, but it kind of depends on what you're trying to do.
If you just want to see which transit routes might be affected by flooding in certain areas, it might work better for you to create a simple feature class of your GTFS shapes.txt file using the GTFS Shapes To Features tool. That feature class will show the paths traveled by the vehicles, at least according to the data the transit agency has provided (which, in my experience, depending on the agency, can sometimes have problems). You could overlay these with your flooding polygons.
That approach doesn't do anything with routing, through. But here's the problem if you tried to make your flood polygons work with a routable network, even assuming the transit lines were in the right place geographically. Suppose you use your flood polygons as a barrier, so certain segments of the route and certain stops are inaccessible. The solver will be smart enough to prevent a traveler traveling on transit from traveling through that section. However, the transit lines further down the line, after the flooded area, don't know that the previous parts of the line are blocked or diverted or delayed, so they continue running on the same schedule. A passenger will still be allowed to board the bus and travel onwards using the same schedule, even though that's unrealistic.
If you post more details about what analysis question you're trying to solve, maybe we can brainstorm a good solution.