What is tension force?

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.

what exactly is tension force?

Tension force is just a pulling force. It always pull the other object. To be very precise, tension is a scalar quantity. Tension is like what pressure is in 3D.

Why is it just a pulling force?

I am only talking with respect to string. It is only a pulling force as in Newtonian mechanics strings are inextensible and the length of the string is constant.

Suppose if two blocks connected with a string are pushed towards each other. Since the length of the string will be compressed, the tension developed in the string will be 0.

The net force on the string is 0 as it's mass-less.

Now, if the length of the string is divided into $$dx$$ elements, each upwards $$dx$$ element will pull the downward element, and by Newton's third law the upward $$dx$$ element will be pulled downwards by the lower element.

All the picture credit goes to @satan29.