The point of
esc_html is to ensure that the end result is plaintext, no HTML tags or scripts etc, just plaintext. The
__ part passes it through the localisation API, and the
e indicates it will
echo on its own. So what you are seeing is expected and normal.
Instead, you will need to make use of
sprintf, you will need to eliminate the
_e part and
echo yourself, and you'll need to use a placeholder for the link.
something similar to this:
esc_html__( 'Apples can be red or green %s', 'textdomain' ),
'<a href="/apples">' . esc_html__( 'click here to learn about apples', 'textdomain' ) . '</a>'
Remember, HTML tags inside localised strings are not good, they're a sign you've made a mistake or missed something. Avoid them and use placeholders or split them up into shorter strings.
They can also indicate problems with copy/grammar/SEO/accessibility. In this case, the highlighting of just the word log in suggests poor accessibility for those using screen readers or automated bots such as search engine crawlers. Here, the link says "log in" but the links text does not contain any context for why you might want to do that, or where the link leads, e.g. it's not clear that it leads to the my account page or that you can register via that page.