I’m stuck with a and the. What is the mental process to choose between them? [duplicate]

You use 'the' when referring to something specific. 'The' is a definite article.
'A' when referring to something general, it's an Indefinite article.

This is 'a' computer

or

'The' computer over there

One of many sources: https://www.dictionary.com/e/definite-vs-indefinite-articles/