Why curve modifier goes in different direction
The curve and the object have to have their origins in the same place, otherwise you will see an offset and get unexpected results.

Snap ( Shift S the cursor to the curve, and then snap the object to the cursor.

Then the deformation can take place corectly.



Note that the origin of the deformed object will be placed at the first control point of the curve.