MVC uses conventions over configuration. The views are filenames. There is a search pattern and order defined to match the view with the action name defined in route table. Shared is one of the paths searched.
https://learn.microsoft.com/en-us/aspnet/core/mvc/views/overview?view=aspnetcore-9.0
if you are coming from webforms, you might prefer razor pages. In razor pages the views are compiled and have a code behind. While MVC is stable, razor pages is receiving new features.
https://learn.microsoft.com/en-us/aspnet/core/razor-pages/?view=aspnetcore-9.0&tabs=visual-studio