Follow the below guide to set enable/ disable Guest Checkout.
Step 1: Navigate to Stores > Settings > Configuration

Step 2: At the Configuration page, on the left menu click on Sales to expand then click Checkout

Step 3: Expand the Checkout Options then you can see Allow Guest Checkout setting. Set to "Yes" to allow guest checkout and "No" will require customer to login before checkout. Click Save Config to apply the changes.

Once done, you have to flush Magento Cache to apply the changes setting and reflect on live site.