This is happening because the console.log
gets to run before the dbquery which is running asynchronously, finishes. When using .then, whatever you want to do with the values should happen within the callback function of the operation.
A neater way of achieving what you want would be to use async-await. Your code structure would change a bit.
let arr =[];
let a = await l.kategoriler.findAll({where:{server_id: "991656640401113118"}})
a.forEach(b =>{
arr.push(b.kategori)
})
console.log(arr)
It is vital that the function containing this snippet is an async function if not you'd encounter errors.
You could read up on async-await if you need to here: https://javascript.info/async-await