As a 50-year native U.S. speaker, I would say that both are technically correct, though the second one sounds more natural. And the reason may be merely because the "extra" word "did" can be made unnecessary, and make the sentence flow better, when phrased the second way.
In the spirit of simplifying words as if they were fractions, if "did " can be replaced by "" (as a single word), folks generally favor doing so.
But that does not mean to throw away "did" if it is the only natural verb. For example, this is perfectly correct:
Does anyone know who did that?
As you see, "did" is the only action to go with "who" in that question. But if you completely replaced "did" with another verb, like:
Does anyone know who threw that?
The simple past-tense of "throw" is easier and more natural to say (and type) for a native speaker, than "Does anyone know who did throw that?" Perhaps the internal "gut" rule here should be "keep it simple?"
But just to give you first version any chance at all, it would work/sound better if there were a punctuation separating it into 2 parts like so:
Does anyone know: When did X unfollow Y on Instagram?
Does anyone know ... when did X unfollow Y on Instagram?
Basically, I'm inserting a dramatic pause there, especially workable if speaking it aloud. But I would not consider writing it that way formally. I would only use such a written construct in, say, a text, informal email, or ... an Instagram comment. :D