The term role-playing game has roots in the history of psychology.
In fact, The first to coin the term “Role Play” was Jacob L. Moreno in 1934, after experimenting in 1921 the “theatre of spontaneity”.
Jacob Levy Moreno was a leading psychiatrist, thinker and educator and has been recognized as one of the pioneer of group psychotherapy.
In 1930 Moreno emigrated to the United States and began to develop the technique of psychodrama which is still used in psychotherapy: in the psychodrama technique the patient has to recall and act (like he is on a stage) a past conflict he had against someone.
Then the roles are switched and the patient plays the part of his opponent to try to understand what the other person has felt in that occasion.
But this first sense of the word role-play has no relation with the role play intended as recreational activity, derived from war–games.
The role-playing games were played for the first time in the late sixties at the University of Minnesota war-game society.
In 1971, one student Gary Gygax developed in a war-game with medieval setting called Chainmail, wich become very popular among all Minnesota undergratduates.
But was only in 1974, when Gygax and his mate Dave Arneson invented and released the first edition of Dungeons & Dragons that that role-playing games became worldwide famous.
For this reason, D & D is considered the first modern role-playing game and had a lot of influence on later role-playing games.