Evil is not necessarily cackling with laughter, hatching plans to destroy the world and stroking white Persian cats. Go on, actually read what it says on p. 122 of the Player's Handbook. As well, read How do you adjudicate what alignment a PC's actions are?
All psychopaths are evil but not all evil characters are psychopaths.
An evil person in D&D 5e puts their interests ahead of the interests of others. Such a person may coexist quite happily and peacefully in civilised society and be known as nothing more than someone with sharp business practices and a hard touch for charitable causes. However, when the Titanic hits the iceberg and its "woman and children first", this is the guy who gets picked up from the lifeboat in drag.
Individuals might vary significantly from
that typical behavior, and few people are perfectly and
consistently faithful to the precepts of their alignment.
Betraying your friends and colleagues is something someone of any alignment could do; motives matter! In fact, such a long term plan is unlikely to be followed by a Chaotic person irrespective of their ethics.
Can I play an evil character without letting anyone but the DM know?
If your DM agrees to this, sure.
How else does one play an evil character in a good campaign?
By being open that you are evil, that is, your motivation is, first and foremost "what's in it for me?" Get a little sign made up and put it on the table each session.
An evil person is quite willing to save the beautiful dragon from the hideous princess provided the rewards to them outweigh the risks; they won't do it just because its the "right thing to do." Tell the other player's not to waste time trying to engage your better nature because you haven't got one! If they want you on the quest there better be some real personal incentive like cash, magic, power or whatever your traits, bonds and flaws lead you towards.
Alternatively, everyone can play with secret alignments and personality: in real life I have meet plenty of self-centred, narcissistic, inconsiderate so-and-sos but none of them ever announced this to me when we met - I had to learn it for myself. Remember, in D&D 5e there is no way that your alignment can be revealed magically - Detect Evil and Good is misnamed because it doesn't do that. What it does do is:
... 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
So unless your character is "an aberration, celestial, elemental, fey, fiend, or undead" you are safe from this.