You can register as a Democrat and participate in the primaries for the Democratic candidate but (thanks to the secret ballot) vote for Republicans in the final election. Or vice-versa. And nobody other than you will ever know how you (as an individual) actually voted.
Or you can register as an independent if you prefer. The rules vary by state, but the worst that happens is you can't participate in the primaries (but can absolutely vote in the final election). Who you, as an individual, voted for is still not traceable back to you.
In other words, it's your right, thanks to the secret ballot, to vote completely differently from the party you registered under or even differently from how everyone in your life perceives you, and nobody will ever know.
There are people who changed their mind years ago about what party they support and have been voting that way ever since, but just haven't gotten around to (or don't care enough to) update the party they listed on their voter registration.
Some states, such as Georgia, don't have party registration at all. You're not a "registered Republican/Democract," just "registered."
Any registered voter can choose to vote in either the Republican or Democratic primary (unsurprisingly, this "open primary" system was originally implemented in order to supress the Black vote).