Ideally speaking, there is no major difference between the words "hastily " and "quickly". Both come from the verbs' Haste' and 'Quick' and are used here as adverbs to qualify the verbs.
Hastily: It refers to a work done hurriedly.
Quickly: It can refer to both, work is done hurriedly or something indicative of speed.
Thus, when one needs to denote the meaning of being in a hurry, with no time even to sit, relax and breathe, one uses 'Hastily'. But when one uses the word in a sense to indicate speedily, say 'Wait, I will quickly prepare Maggi for you.' Here, 'hastily' cannot be substituted to 'quickly'.
Therefore, these two words have different connotations with a slight difference in meanings.