The Curve modifier will deform the object along the Y axis if you set Deform Axis to (positive) Y.
However it has to orient one of the other axes of the object along the normals of the Curve. In this case it picked the object Z axis, which is why the result is rotated 90 degrees.
You can resolve this by adjusting the normals orientation using the curve tilt.
In Curve Edit Mode - Select all control points and press Ctrl + T (same as accessing the menu Control Points > Tilt)
Observe what happens with the deformed object when you move your mouse.
If you type 90 when tilting you will set the tilt of the curve to 90 degrees, which will align the Normal direction of the points with the Z axis of your object. Press Enter to confirm.
You can preview the normals of the curves in Edit Mode by toggling on the Normals checkbox in Curve Edit Mode Overlays.