How does a game engine work and how can you use that to make one?

I was wondering how I can take how a game engine works (which I have some knowledge of) and was wondering how I can take that and its algorithms and equations or something to develop a simple physics or rendering engine to build my knowledge on how they got there. I know this stuff might be hard to wrap my brain around but I really like learning this stuff so anything will be great!

Professionally made game engines like Unity are made with large teams over a long time. The most basic part that is in every game engine is the game loop that runs constantly, it keeps track of time between frames and limits frame rate if needed. In the game loop, you would add on stuff to be updated every frame and all the other calculations of physics and rendering. Of course, an engine like Unity has a lot of bells and whistles, and a whole UI that makes using it easier, but that’s mostly just for commercial use. All you really need is a game loop with physics and/or rendering, then make other classes and methods to create stuff to put on the screen. You’d also want input handling too. Making game engines is not an easy task and unless you’ve got a very strong knowledge of Object-Oriented Programming(OOP), I wouldn’t worry about making one.

Ok so there is a loop that runs constantly updating the game and then there are some graphics and audio interfaces that help also.
I am wondering though about the graphical interfaces do they handle the actual game graphics, the engines UI graphics, the design graphics or all?
Also, do you just need Visual Studios or any other compiler and a graphical interface and an audio API?

Thank you guys so much so far I have actually learned a lot!!! I am amazed at how helpful its already been thanks!