Well, part of the charm of Mathematica is the possibility of writing "C-like" programs
As a rule of thumb, avoid using "For" loops whenever you can
In your case the for does nothing really, so you may replace it with Do and to speed up, if you have a multicore processor replace the Do with ParallelDo
$T = 99; $y1 = 31; $y2 = 27;
ParallelDo[
Do[
$xy = $x1;
If[$x1 >= $y1,
Break[]];
$yy = $x1;
Do[
$xy = $x2;
If[$x2 >= $y2,
Break[]];
$yy = $x2,
{$x2, 1, $T}],
{$x1, 1, $T}],
{$xx, 10^3}] // AbsoluteTiming
This speed up thing on my old laptop by factor of 4
BTW, why using $ signs in front of the variables (looks like Pearl). This might cause you problems as many of internal Mathematica constants use this notation.