This is a superscription that tells about the psalm. Some scholars say that this is part of the scripture and some say that it is not. (See "What are Superscriptions in Psalms" in [Introduction to Psalms](../front/intro.md).)
This is an idiom that means to say to oneself or to think to oneself. Alternate translation: "A foolish person says to himself" (See: [[rc://en/ta/man/jit/figs-idiom]])