To avoid the leading edge, the air is initially deflected upwards. Due to inertia, it would continue upwards. However, viscosity prevents it from having sharp shears of velocity, so the air just above the wing gets pulled out, creating the area of reduced pressure that pulls the oncoming air to turn around the wing—the suction peak. Sharper leading edge means the angle between the air and the curving surface grows faster, so it needs deeper suction peak to keep the air attached.
Since the viscous forces are only so strong, they can only make the air follow a so sharp curvature. As the angle of attack increases, the air flowing over the upper surface has to navigate around more of the leading edge. With sharper leading edge the angle it has to turn increases faster, so it will start to separate earlier.
The trailing edge stall is also related to viscosity. It prevents velocity discontinuity also at the wing surface, so near the surface there is boundary layer where the stream velocity changes from zero to the free stream velocity. This boundary layer grows in thickness, more at higher angle of attack, and when it becomes so thick that the viscous forces are insufficient to keep it moving, a separation bubble creeps in from the trailing edge. This is why wings with longer chord stall at lower angle of attack. Even if it is the same profile scaled up.
This also explains how vortex generators increase the critical angle of attack: turbulence mixes the boundary layer, increasing the velocity in it even if the average aft component does not increase, which prevents it from stagnating and separating completely.