"Dirty" is a more casual word, while "erotic" is a bit more general and used in academics. For example, art with sexual activity in it would be called erotic. Dirty would be used for things like erotic dancing ("dirty dancing" like stripping) or "dirty talk" (talking about sex with someone you are flirting with)