Is a question beginning with "How to" grammatically correct?

They are grammatical, but they should be used with care, because they are subordinate clauses, rather than complete sentences. They might occur as headings, or at the start of a paragraph that goes on to answer the question. Even then, they are generally confined to informal writing. You wouldn’t expect to find them in academic prose, for example.


1 They are not questions. (Don't be surprised.)
2 They are not even sentences. (In a sense.)

1 Considering the widespread use of such expressions as (book, chapter, section or paragraph) titles, ending the expression with a mark of interrogation ? is a common error. How to save money used in a standalone way means '(Here is a way that shows) how to save money'. Do not end it with a question mark.

2 By now it can be already seen that these are mere phrases and not sentences. However, when used in a proper context, with a question mark, they can serve as grammatical sentences, as in, "I don't have the manual now. How to fix my computer?" Per the advice of @BarrieEngland, these expressions should be avoided in formal writing.