Error 522 when proxied | no problem when DNS Only

May I ask what is the domain name? Moreover, I assume you mean you changed your nameservers to Cloudflare ones, right?

Have you tried accesing your Website with some different Web browser or different device? (maybe clearing your Web browser cache and restarting router due to DNS propagation if the domain is recently bought and added to Cloudflare).

Moreover, who is your hosting provider?
Maybe they blocked something or prevent Cloudflare to connect to your host/origin?

Okay, meaning if you Pause Cloudflare for your domain or temporary switch the :orange: cloud to :grey: cloud it is working properly?

May I ask have you checked the suggestions from the below article?:

https://support.cloudflare.com/hc/en-us/articles/115003011431-Troubleshooting-Cloudflare-5XX-errors#522error

Have you allowed Cloudflare IP addresses to connect to your new host/origin?
Maybe you need to allow Cloudflare IP addresses to connect to your host/origin server:
https://support.cloudflare.com/hc/en-us/articles/201897700-Allowing-Cloudflare-IP-addresses

IP list here:

How about your web application?, does it work on a port which is compatible with Cloudflare as follows in the below article:
https://support.cloudflare.com/hc/en-us/articles/200169156-Identifying-network-ports-compatible-with-Cloudflare-s-proxy

Is the SSL certificate covering both your main domain and your sub-domain(s) like www?

Can you check what have you got selected under SSL tab at Cloudflare dashboard? Is it Full SSL or something other?

A good thing would be to check here too: