Why did aliasing occur at a frequency before the Nyquist cutoff?
What you are seeing is not aliasing. It's simply an artifact of the way your scope is rendering the data it had captured.

When you sample a 400 Hz sinewave at 1000 sps, you're only capturing 2.5 samples per cycle. Obviously, most of these samples aren't going to be at the peaks of the waveform. Therefore, when your scope draws simple straight lines to connect the points, you see a waveform whose amplitude varies periodically.

In order to properly reconstruct the waveform for display, the scope really should be oversampling the data and passing it through a low-pass filter with a sharp cutoff.1 But this is computationally intensive, and so most scopes skip it. They usually just tell you to use a sample rate that's at least 10x the highest frequency of interest.

1 This is just another way of saying "interpolate with a sinc function".