Hard to say because you did not provide the exact model of the Mac. You can get the exact model by entering your serial number within this Apple article:
Check Your Service and Support Coverage - Apple Support
Run the Apple Diagnostics to see if any hardware issues are detected. Unfortunately the diagnostics won't detect a lot of drive failures or other issues.
Try booting into Safe Mode. It will take longer than normal to boot into Safe Mode because macOS is running a file system check and other things such as deleting some temp & cache files.
Also, when running First Aid, you should run First Aid on the hidden Container instead of just the "Macintosh HD" volume. Even if First Aid says everything is "Ok" click "Show Details" and scroll back through the report to see if there are any unfixed errors listed (First Aid sometimes lies about the results of the scan). If there are any unfixed errors listed, then you will need to erase the Container (if an Intel Mac, erase the physical drive) and restore from a backup or clone. Within Disk Utility you may need to click "View" and select "Show All Devices" so that the hidden Container appears on the left pane of Disk Utility.
See this Apple article:
If your Mac starts up to an Apple logo or progress bar - Apple Support
You may also want to disconnect all external devices in case one of them is causing a problem.
If these things don't help, then most likely you will need to have Apple or an AASP examine the Mac.