The arviz code used to compute the HDI is here.
The difference between an HDI and a confidence interval is a much longer discussion. I recommend the wikipedia articles here and here.