In the D&D universe being good/evil/chaotic/lawful is a tangible fact that can be measured with the correct tools (spells). It's tied to the governing forces of the universe. So yes, in the D&D universe if one is so deeply consumed by hatred, anger and evil thoughts one might result as evil.
Not since 5e it isn't. Text of Detect Evil spell in 5e:
For the duration, you know if there is an aberration, celestial, elemental, fey, fiend, or undead within 30 feet of you, as well as where the creature is located. Similarly, you know if there is a place or object within 30 feet of you that has been magically consecrated or desecrated.
Know Alignment spell has been removed from the game all together.