Sometimes it can be a case of your story not being quite right for the initial market you thought it would suit. That can be due to personal taste by the publication or because they've accepted another story on the same sort of lines as yours (both of which you as the writer have no control over).
The important thing is not to give up, always take a good hard look at the story and try again elsewhere. I would add if the story is then rejected another time, put it aside for a while (ideally at least a week) and then look at it again with fresh eyes. I've "suddenly" spotted things when I've done this that I hadn't done when I'd submitted the tale. I've then realised those things I hadn't initially spotted almost inevitably were the reasons the story was turned down at all.