I have noticed that they are not ordered according to the level of upregulation and downregulation. I could not understand the 'distance' based calculations or what they mean. Any clues?
It depends what data you've used as input and what type of distance calculation you've used. There are also different clustering methods and you can cluster by row or column.
From what I understand, clustering iteratively joins pairs with the smallest distance between them into groups.
This post on Biostars might help since it talks about different types of clustering for heatmaps in R: https://www.biostars.org/p/14156/
If you are still looking for an answer to this question, pop down to the cafe in Hadyn Ellis at 3pm today (Thursday's) and show them the heat map along with the paper/database you got it from. They will be able to tell you exactly how the heat map has been generated, and answer any further questions you may have.