SQL beginner trying to calculate total time in minutes; need help with WHERE syntax error
You are overcomplicating things. 

You only need one derived table (aka "sub-select"). Using a lateral join makes it possible to push the values from the outer query into the sub-select:

select a1.empid, a1.log_date::date, sum(a2.log_date - a1.log_date) as duration
from activity a1
  join lateral (
    select min(off.log_date) as log_date
    from activity off
    where off.action = 'OFF'
      and off.log_date &gt; a1.log_date
      and off.empid = a1.empid
  ) a2 on true
where a1.action = 'ON'         
group by a1.empid, a1.log_date::date;


This assumes that an OFF event always comes after an ON event.

a2.log_date - a1.log_date returns an interval. Do turn that into minutes, extract the epoch value from that interval which is the interval in seconds. Then divide that by 60:

extract(epoch from sum(a2.log_date - a1.log_date)) / 60 as minutes