Extracting a day part from an interval does not do what you think it does, e.g. the resulting interval could be 5 months 6 days and then the extract would return 6.
If you just want the number of days for the current date, use doy
select extract(doy from current_date);
which is a shortcut for
select current_date - date_trunc('year', current_date)::date
Online example
Edit
Your timestamp calculation doesn't include the full day of the last day, and - as explained - extract(day from ..) extract the day part of the interval not the length of the interval in days.
Additionally, to_timestamp() returns a timestamp WITH time zone which also takes into account that one of the days in your interval is shorter than 24 hours:
You can see this when looking at the result without using extract:
select to_timestamp('2020-05-22', 'yyyy-mm-dd') - to_timestamp('2020-01-01', 'yyyy-mm-dd') as c1,
to_timestamp('2020-05-22 23:59:59', 'yyyy-mm-dd hh24:mi:ss') - to_timestamp('2020-01-01 00:00:00', 'yyyy-mm-dd hh24:mi:ss') as c2
returns
c1 | c2
-------------------------------------------------+---------------------------------------------------
0 years 0 mons 141 days 23 hours 0 mins 0.0 secs | 0 years 0 mons 142 days 22 hours 59 mins 59.0 secs