The movie allows people to take over characters body's in a computerized virtual reality with new technology. The main character some man, travels to a reality which takes place in the 40s? and he witnesses murder and a car accident. If he dies in this place i'm pretty sure he dies in real life. A lot of mystery solving goes on in the virtual reality. At the end they realize their lives are also being taken over because their reality is fake as well. And someone gets murdered at the end which ties in why. Also they are standing on a beach for part of the film at the end.
This sounds like "The 13th Floor"
A group of scientists in the 1990's create their own virtual reality set in the 1930's.
The big twist at the end reveals that:
Their reality is just a simulation created by beings from the future. The future beings have many simulations, but this is the first simulation to create it's own simulation within it.