How do I achieve this in subquery
SELECT tableA.genre, 
       COUNT(tableB.genre) hit_movies, 
       SUM(CASE WHEN tableB.genre IS NULL
                THEN 0
                ELSE tableA.collection
                END) total_collection
FROM tableA
LEFT JOIN tableB ON tableA.genre = tableB.genre AND tableB.performance = 'Hit'
GROUP BY tableA.genre


fiddle

Option proposed by a_horse_with_no_name (PostgreSQL-specific):

SELECT tableA.genre, 
       COUNT(tableB.genre) hit_movies, 
       SUM(tableA.collection) FILTER (WHERE tableB.genre IS NOT NULL)  total_collection
FROM tableA
LEFT JOIN tableB ON tableA.genre = tableB.genre AND tableB.performance = 'Hit'
GROUP BY tableA.genre


The difference - first query outputs zeroes for the genres without hits whereas second one outputs NULLs. May be changed by replacing zero with NULL (or by replace the whole CASE expression with CASE WHEN tableB.genre IS NOT NULL THEN tableA.collection END) in the first query or by wrapping the expression with COALESCE() in the second query.