From what I understand, both can mean activity, but действие also means action.
However, they seem similar enough that I don't know when to use which.
According to this frequency list, действие is ranked #83 among Russian nouns, #302 overall. деятельность is ranked #94 among Russian nouns, #322 overall. Given the prevalence of these 2 words, I believe a deeper understanding of when to use each is necessary.