Hypnosis is a tool that makes it possible to induce a state of relaxation, during which you are focused on a specific perception or imagination and external stimuli become unimportant. This provides direct access to the subconscious.
Since humans have existed, there has also been hypnosis, because it is a natural state that feels familiar, as we are often in it several times a day, e.g., when reading an exciting book, watching a captivating film, daydreaming on the train, or realizing we just missed the highway exit.
"Hypnosis is the bypassing of the critical factor of consciousness and the establishment of acceptable and selective thinking" (Dave Elman)