Where does confidence truly come from?

Where confidence truly come from? Especially for men?

I would consider myself to be low confidence and low self esteem. I did use to be pretty heavy weight wise but I am in better shape now. Actually much better shape. However, my confidence is still very low. I would consider myself more like a gymcel basically. I am also on the older side now I guess. I am 32. So 32, never been in a relationship, all that stuff etc. Where can I even start?

To me, confidence just seems like straight lying to yourself. How can you ever reasonably say "I am the best at this or that." To me, that just opens you up to underestimating someone or something and you getting absolutely destroyed. So what is true confidence? How I understood it is that confidence is built across many many VICTORIES in life. Emphasis on victories. So if you spent your whole life basically losing, then your confidence is shot to hell.