The tried and true way to do it, which is how I started, was to install the Apache web server (which can be done on any of Windows, Linux or Mac OS), the PHP module for it, and MySQL to use as a database. You can run it locally on your computer and just use
http://localhost to access webpages served up by your server.
Following up on that, the bad old way, which again is how I started, was following very bad PHP + Apache + MySQL tutorials that tried to teach you how to do all of the above with absolutely no security or good practices in mind. It's a simple way to get started, but beware what you might find. In particular, if you do decide to learn PHP + MySQL, try to find a tutorial that teaches you how to integrate the two using PDO and
not the built in mysql_* functions, which are deprecated and insecure.
A much more modern approach, which is probably simpler, is to install NodeJS and write your pages in server side JavaScript. You can again do that on any platform, and it requires less configuration than Apache, but you have to learn to install and use extra libraries to even do something as simple as serve a webpage. You'd need to install Express at a minimum to do that without tearing your hair out, and the tutorials you find might make the whole process more complicated than it needs to be. Make that even worse if you want to use MongoDB, which is the de facto database people use with NodeJS these days. MongoDB is a lot harder to use than MySQL in my experience, at least from a database management point of view.
Or, if you're interested in just doing simple things that don't require any kind of server side logic, you can even just write the webpages using Notepad and just point to them in your browser. C:\Users\[your user name\Documents\index.html for example. You can do a lot this way and don't even need to install a server, but you can't do database integration, sessions or things like that.