What we call a tension force is actually the net result of the electromagnetic forces which hold the rope together as something tries to pull it apart. At every small cross section of the rope there are forces acting perpendicular to that cross sectional area, and hence act (generally) parallel to the length of the rope. If the rope is not stretching and the weight component of the rope acting parallel to the length is small compared to the forces acting on the ends of the rope, the tension will be (nearly) constant.
And the direction of the forces which the rope exerts on things is always pulling. So, if a mass is hanging vertically in equilibrium from a single rope which is attached to some ceiling point, and its weight is large compared to the weight of the rope, the tension force which the rope exerts on the mass is up (pulling) and is equal in magnitude to the weight of the mass. The rope is also pulling down on the ceiling point with the same magnitude force, the tension.
If the rope/mass structure is accelerating upward, the tension force has a magnitude greater than the weight of the mass and is upward. If the structure is accelerating downward, the tension force has a magnitude less than the weight, but its direction is still upward because ropes ALWAYS pull.
One way (but not the only way) to think about it is tension is the magnitude with which a rope or cable can pull at any point along the length of the rope. Wherever that point is, the direction of the tension force pulls away from that point. That means that each point in the structure of the rope is in equilibrium, so it doesn't accelerate relative to other parts of the rope.