Insecure means either lacking self-confidence or lacking security. An insecure person might constantly doubt their own intelligence. An insecure building is an easy target for even the most bumbling burglar.
Break insecure down to its basic parts and you've got in, meaning "not," combined with secure, meaning "safe": not safe. This understanding of the word emerged in the 1640’s. It wasn't until 1917 that people began to use insecure to describe delicate, unsure egos. Today it's used to describe everything from easily cracked safes to uncertain futures.