Safari randomly and periodically loses cookies
It could be of because reasons mainly,


Any unwanted extension that is supposed to behave this way
Some software running in background to clear caches for freeing up space
Browsing in Incognito Mode