An ordinary web page is stateless - it doesn't have any way to tell what interactions you may have performed in the past. A stateless web page can tell whether the links in the page have been visited or not based on whether the page can be found in the browser cache but beyond that the page cannot tell anything about your past accesses.
At least that is how web pages work until such time as you introduce a mechanism for maintaining state between pages. There are two ways of maintaining state - one is to store something on your visitor's computer that can be read in by the browser on each visit (first/third party cookies or localStorage) and the other is to store the information inside the browser so that it only exists for the current browser session (session cookies or sessionStorage or in the querystring on the end of the web address).
One thing that you can do with sessions is to link pages together where information your visitor enters on one page is available to other pages on the site - for example if you have several forms they can fill out you can use a session to prefill the fields on each form that have already been entered on prior forms.
A more obvious use for sessions is where you require your visitors to login to use your site. In this case the session is used to pass information about which particular login id is being used and also to identify whether your visitor has logged in or not. In this situation moving most of the data out of the session into a database makes even more sense since you will almost certainly want it to be available again the next time that person logs in.
Sessions provide a mechanism for giving web pages a state based on prior actions within the browser without needing to pass huge amounts of information via other mechanisms that were never intended to hold much information. Sessions also make it harder to predict what value other current users may be using as it generates a random value to identify each session rather than relying on specific known data. If identifiable data were used to pass the state between pages then anyone who knew that data could potentially intercept the session by sending the same data to the server.
This article written by Stephen Chapman, Felgall Pty Ltd.