Using X-pack anomaly detection on my own time series data

But I want to use it on my own data that does not come from Elasticsearch.

Indeed. Not supported. You must index data into elasticsearch. There are tons of connectors to do that easily. Have a look at logstash for example.

I want to know if the code for performing the detection is open source by any chance

No. It's not.