You're not fretting with your fingers coming straight down on the frets, you're doing it at a shallow angle; so when you bend, as you said, the string above gets caught under your nail.
Solution; just pay more attention and actively try and focus on fretting more vertically. After a while you don't even need to think about it ;D