A rotating electrical machine comprising: a rotating shaft intersecting a gravitational direction and defining a rotation axis; a stator having a stator core and a first-end-side coil end part that protrudes axially outwardly from a first end surface of the stator core on a first axial end side of the stator core; a rotor; a case which accommodates the stator and the rotor; a temperature sensor that is attached to the first-end-side coil end part; a terminal block provided with input/output terminals for the rotating electrical machine and attached to the first-end-side coil end part; and a first discharge mechanism having a plurality of first discharge holes, through which a refrigerant is discharged toward the first-end-side coil end part, on a first surface of the case that faces the first-end-side coil end part in an axial direction of the stator core, wherein: the first discharge holes of the first discharge mechanism are disposed in a region excluding an avoidance region; the avoidance region is the same region as an arrangement region that is one of a right side region and a left side region with respect to a vertical line (Lv) passing the rotation axis as seen in the axial direction of the stator core, the one of the right side region and the left side region being a region in which the temperature sensor and the terminal block are arranged and the avoidance region is located above a lower end of the temperature sensor in the gravitation direction, and the terminal block being located above said lower end of the temperature sensor in the avoidance region; the temperature sensor is attached to a region of the first-end-side end part above a horizontal line (Lh) passing the rotation axis as seen in the axial direction of the stator; and both the temperature sensor and the terminal block are disposed at positions shifted from the vertical line (Lv) above the horizontal line (Lh). a rotating shaft intersecting a gravitational direction and defining a rotation axis; a stator having a stator core and a first-end-side coil end part that protrudes axially outwardly from a first end surface of the stator core on a first axial end side of the stator core; a rotor; a case which accommodates the stator and the rotor; a temperature sensor that is attached to the first-end-side coil end part; a terminal block provided with input/output terminals for the rotating electrical machine and attached to the first-end-side coil end part; and a first discharge mechanism having a plurality of first discharge holes, through which a refrigerant is discharged toward the first-end-side coil end part, on a first surface of the case that faces the first-end-side coil end part in an axial direction of the stator core, wherein: the first discharge holes of the first discharge mechanism are disposed in a region excluding an avoidance region; the avoidance region is the same region as an arrangement region that is one of a right side region and a left side region with respect to a vertical line (Lv) passing the rotation axis as seen in the axial direction of the stator core, the one of the right side region and the left side region being a region in which the temperature sensor and the terminal block are arranged and the avoidance region is located above a lower end of the temperature sensor in the gravitation direction, and the terminal block being located above said lower end of the temperature sensor in the avoidance region; the temperature sensor is attached to a region of the first-end-side end part above a horizontal line (Lh) passing the rotation axis as seen in the axial direction of the stator; and both the temperature sensor and the terminal block are disposed at positions shifted from the vertical line (Lv) above the horizontal line (Lh). the first discharge holes of the first discharge mechanism are disposed in a region excluding an avoidance region; the avoidance region is the same region as an arrangement region that is one of a right side region and a left side region with respect to a vertical line (Lv) passing the rotation axis as seen in the axial direction of the stator core, the one of the right side region and the left side region being a region in which the temperature sensor and the terminal block are arranged and the avoidance region is located above a lower end of the temperature sensor in the gravitation direction, and the terminal block being located above said lower end of the temperature sensor in the avoidance region; the temperature sensor is attached to a region of the first-end-side end part above a horizontal line (Lh) passing the rotation axis as seen in the axial direction of the stator; and both the temperature sensor and the terminal block are disposed at positions shifted from the vertical line (Lv) above the horizontal line (Lh).