I am new to rendering in Blender
The problem here is that the lighting in the viewport is different from the output, and I can't understand why.
Okay, so the thing is, what you're viewing in the viewport, that's Material Preview Mode. In Material Preview Mode, blender applies a default HDRI (World Lighting) so that we can see the materials without any lighting.
Then comes Rendered Dispay mode, there we're supposed to add in lights and everything, so that we, the user have full control. But, if you want the lights from Material preview mode to carry over to Rendered Display mode, all you have to do is uncheck scene lights and scene world from the dropdown next rendered display icon on the top right, as shown below.
If you want to render it in as well, all you have to do is go to the Shader editor, and switch it from object to World
Add in an enviroment texture node by shift + A and searching Environment Texture, then click on open.
Navigate to where you've installed blender, and go to the relative data path mentioned below.
Blender Foundation\Blender{Version}\{VersionNumber}\datafiles\studiolights\world
There you can find all the HDRI's blender use. The default one should be Forest.exr
Load it up and connect it to the Background node. Now you should be able to render it in.
Scene Lights
andScene World
fromViewport Shading
if you want your viewport render to look like your final render. $\endgroup$