There's a couple of things going on here:
The Doctor Lies -- And Cheats
The Doctor breaks the rules all the time. Yes, he cannot cross his own timeline... except for the half-dozen times he does just that and gets away with it. This is part of the flexible, mutable nature of time travel rules in Doctor Who: there is no hard and fast rule.
Examples of The Doctor explicitly crossing his own timeline include "The Three Doctors", "The Five Doctors", and "Day of the Doctor". In all of those cases, he did the exact thing he claims he can never do, and ended up saving the day.
As viewers, we're supposed to mostly just accept that Time Lords instinctively know when it's safe to do these things, and when it's not. The one time The Doctor went against his instincts -- "Waters of Mars" -- the universe smacked him down anyway.
Timeline vs. Timestream
Second, there's a difference between the Doctor crossing his own timeline, and what he did in "Name of the Doctor". When the Doctor says he can't cross his own timeline, he's concerned with doing something that would alter his own history. That could create a paradox that the Universe cannot work around; we've seen that such paradoxes can result it very bad things for the people involved (e.g. in "Angels Take Manhatten", a huge stretch of time was just "undone" to resolve a paradox).
In the "Name of the Doctor", Clara had entered into some kind of energy manifestation of the Doctor's entire life, and dispersed herself across his timeline. Even though she was intentionally trying to interact with him, it seemed pretty difficult. The Doctor went into that same environment merely trying to pull Clara's pieces back together. He wasn't really in a position to interact with himself or cause major changes to his own timestream by accident, so the risk seemed a lot lower.