To get the idea of how this works, it is probably easiest to download an app and start trying it for yourself. Many of the new Samsung phones have a free camera plugin called "Surround Shot" that will walk you through the steps of creating a 360° photo. iOS users can use the the Google Street View app to access a photosphere function as well.
Once you've snapped your 360° photo, simply load it into a compatible viewer for google cardboard, Gear VR, Oculus, Vive, etc. The Oculus 360° Photo app works great on Gear VR and the Oculus Rift.
*Pro Tip: Use a tripod with your phone and turn off any advanced features such as flash, white balance, autofocus in order to get the best results.
You could also check out this quick Instructable by DivideWorks if you're still having trouble wrapping your brain around the technique. If you want to test out a simple 360° photo, try this one of my empty lab at school.