My website is already deployed with the custom domain name and I have already added all the necessary SSL certificates. It is working completely fine before I connected to my custom domain. I imported the website from GitHub and now I am seeing this error.
I was able to see the deployed website before finishing up the custom domain setup.
This error page comes from GitHub, not Netlify, so one presumes your DNS points to GitHub for your custom domain still. Please check out these articles that describe the correct configuration and what might be preventing a reconfiguration from taking an effect:
If after things have propagated - you should be able to see your changes on a website like https://whatsmydns.net showing identical details to what shown in that first article - things still aren’t working as you expect, please let us know your hostname so we can examine it directly and advise. The fact that you didn’t tell us to start with has ensured that our answer can only be in general, not specific terms thus far.
But since I’ve now equipped you to debug yourself, let us know how it goes