There is an open standard for calendars called ICalendar specification this allows programs like the Calendar app on macOS to subscribe to online calendars and update them automatically. Most calendar applications will support this format, including Google Calendar.
How to add a new subscription to the calendar
Open the Calendar application from the Dock or from your Applications folder. In the main window, you can add a new calendar subscription by choosing File> New Calendar Subscription from the top menu bar or by pressing Option + Command + S.
This will open a window asking you for a URL, which should be a link to a file ending with a .ics extension. Depending on the calendar you are trying to subscribe to, the method of obtaining this link may vary. We will use Google Calendar in this example.
For Google Calendar, you can find the link by opening Settings, clicking on the calendar in the sidebar and scrolling to the bottom of the screen to find an area labeled "iCal's Secret Address".
Copy this address and paste it into the Calendar application dialog. You will receive an error message if the URL was not an iCalendar link, but if it worked, you will see this screen with the subscription settings.
The main points to note here are the name you want to call in the Calendar application and the speed with which it will synchronize with your Google calendar. The default is once a week, but you can refresh it every five minutes (or not at all). You can also change the color of the events with the drop-down menu next to the name.
Press "OK" once you have finished changing the settings. If everything worked, a new check box appears in the sidebar and new events on your calendar.
You can switch to this option to show and hide the subscription. You can also delete the subscription by clicking on it with the right mouse button and selecting "Unsubscribe". You can change the settings from the same context menu by selecting "Get Info", where you can change the frequency of its updates.