Answer: n=2d+2.
Abbreviate Ana, Beto, Carlitos and the candy by A,B,C and D respectively. We also write d(X,Y) for the distance between X and Y.
We claim that for n≤2d+1, C cannot ensure his victory. For the first movement there is no information. Assume without loss of generality that C moves to the left. It could be the case that the initial configuration was the following:
\cline2−6d\cline1−6C\cline2−6 \cline1−6 \cline1−6n ⋯ D ⋯ A ⋯
Suppose A moves to the left on her first turn. After these moves, d(C,D)=d+1 while d(A,D)≤n−d−1≤d. Therefore, no matter how C moves, A will get to D before C does if she always moves to the left.

We will now show that for n=2d+2, B and C can coordinate a strategy to win. We divide the grid into four regions labeled R1,R2,R3,R4 (observe that C's initial cell is not part of any of these regions).
On his first two movements, C moves to the left and to the right, returning to his initial position. This way, after Ana completes her second turn we have d(A,C)≥2d and d(A,D)≥d.
Meanwhile, B uses these two turns to tell C what region contains D, under the following convention:
(hot, hot)→R1(hot, cold)→R2(cold, hot)→R3(cold, cold)→R4
Assume without loss of generality that D is in R1 (for the other cases, analogous strategies are obtained by rotation). B and C's strategy is as follows. In his third turn, C will move upwards. From then on, B will shout “cold” if C is not on the same row as D; otherwise he shouts “hot”. In this way, whenever C hears “cold”, he will know that he must move upwards to reduce his distance to D. And when he hears “hot”, he starts moving to the right. (Note that it is possible that C will never hear “Hot”, meeting D just by going up.)
Since d(C,D) decreases on each turn, after d turns C gets to D. However, to complete the proof we must make sure that A will not get to C or D before C wins the game. Suppose C moved x<d times following the previous strategy. Then d(A,C)≥2d−2x>0 (this is because both A and C move to an adjacent cell on each turn, so their distance is reduced by at most 2), while d(A,D)≥d−x>0 (because the candy does not move). Hence A cannot reach C or D before C wins the game, as claimed.