Insomnia might be hereditary, but in very rare cases there is a form of insomnia called fatal familial insomnia, and it's so rare there are only a few cases seen in the world. However, your case of insomnia is very unlikely to be due to that. In most cases, anxiety and depression are found to run in families.
So if your insomnia is due to anxiety and depression, treating the underlying mental disorder might help you sleep a little bit better at night. When you do have anxiety and depression, you tend to react to stress a little bit more than the average person, and that will prevent you from maintaining sleep and prevent you from having sleep onset at a timely manner.
Now, an evaluation by your physician might help you determine if you do need medication or behavioral therapies to help you sleep a little bit better at night.