A body of mass $m$ is placed on a table. The earth is pulling the body with a force $mg$. Taking this force to be the action what is the reaction?
The reaction force to Earth's gravitational pull in the object is the opposite gravitational pull in the Earth by the object.
Is it true that the reaction of a gravitational force is always gravitational, of an electromagnetic force is always electromagnetic and so on?
If I hang a block of some mass $M$ with an ideal string, is the tension in the string the reaction of the force applied by the Earth? In other words, are the tension and weight an action-reaction pair?
No, but they happen to be equal in this particular example. The earth pulls the block downwards, and likewise the block pulls the Earth upwards. Both forces in this action/reaction force pair are gravitational.
The string doesn't want to break to let the block move downwards, so a tension force appears. String tension pulls upwards in block, and likewise string tension pulls downwards in the string (in the very first particle of the string, and then in turn in every other particle of the string, and finally in the ceiling holding the string). We have an action/reaction force pair here as well.
That the tension force and the gravitational force on the block happen to be equal is just a coincidence in this particular case - it is namely a consequence of Newton's 1st law, a consequence of the block remaining stationary which might not be the case in other examples.
My teacher told me they are, but I really doubt that.
Honestly, I would say so myself. Only because you ask into such detail is it worth the effort for the sake of the understanding to clearly label, which force that pairs with which. In general, forces that are consequences of each other are often mixed together and the action/reaction terms used more broadly.
For instance, if you have an apple on a table that feels a gravitational force down and a normal force up, at those two forces then a action/reaction force pair? No, not if we are accurate in our wording. But since actual reaction gravitational force in the Earth, which pulls Earth upwards, directly propagates to equal the normal force, then we might still say so.
Also note: The terms "action force" and "reaction force" are interchanable. We never really know which force that is the "active" and which that is the "reactive" one. Did the Earth start pulling by gravity in the block before the block started pulling in the Earth as a reaction? This is impossible to answer. So the wording should not be taken too literally here. The important thing to have in mind is just Newton's 3rd law, which all this is about. This law doesn't label any forces as either one or the other, it just states that forces will always come in equal but opposite pairs. If you can find the paired force, then I wouldn't worry too much more about it.