Two parts to this but essentially Gmail will put incoming emails into the Gmail SPAM folder if you have not configured SPF correctly on your sending domain DNS. It will only say,
"Why is this message in Spam? It's similar to messages that were detected by our spam filters. "
Rather than explaining this exactly, and assuming your test email is not written like a ‘409 letter, then your problem is always related to SPF records.
To make sure gmail will deliver emails from your private servers i.e. on your own domain and not a well known public email domain, you MUST have defined the SPF records correctly for your domain.
Here is a list of what can have gone wrong:
Your server uses IPv6. Gmail will default to IPv6 connections if your SMTP handling server has both IPv4 and IPv6. So you MUST add the IPv6 IP address to the SPF record.
You have incorrectly formatted the SPF record e.g. you have accidentally added double quotes around the record when using a web-style DNS record editor on your DNS/registrar.
To see what SPF records gmail found then select the Spam folder in Gmail and click your spammed email and then pick “More” (which is to the right of the display in the Gmail next to the reply button, and then pick “Show Original”.
You need to find the section for SPF and you now need to look for two things,
A GOOD result is,