In a series connection, current flowing across each element is same. So when 40W bulb and 60W bulb are connected in series, same current will flow through them. To find which bulb will glow brighter we need to find the power dissipation across each of them. From the relation
since current is same we can say that power dissipation will be higher for the bulb with higher resistance i.e. 40W bulb.
Hence 40W bulb will glow brighter in series connection.