I believe it was Little Nemo The Dream Master for the NES and Famicom which first released July 1990 in Japan and then followed by the Nemo arcade game which had also released in 1990.
but am not sure if it was trully the first one would gladly want to know.
Probably not the first, but 1986's Mind Walker for the Amiga has you voyaging through someone's subconscious. Pretty interesting game and one of the few published for the Amiga by Commodore themselves.
We here shall not rest until we have made a drawing-room of your shaft, and if you do not all finally go down to your doom in patent-leather shoes, then you shall not go at all.