Would like to know why this query is behaving this way? I have an emp table, with schema and some initial values like below:

 emp_id | name | last_name | role_id 
--------+------+-----------+---------
      1 | hell | bell      |       1
      2 | well | tell      |       2
(2 rows)


And another role table, which emp table has referenced on role_id. 
Below is the role table:

 role_id | role_name 
---------+-----------
       1 | tech
       2 | op
       3 | dev
(3 rows)


I was just playing around, and wrote the below query, which I suppose don't make much sense. 

SELECT emp.name, role.role_name, emp.emp_id 
FROM emp 
INNER JOIN role 
    ON emp.role_id = (
        SELECT role_id from role WHERE role_name = 'tech'
    );


It worked and returned this result:

 name | role_name | emp_id 
------+-----------+--------
 hell | tech      |      1
 hell | op        |      1
 hell | dev       |      1
(3 rows)


I would like to know why I'got this result and how it worked?
Your query, given your data, is equivalent to this one:

SELECT emp.name, role.role_name, emp.emp_id 
FROM emp 
INNER JOIN role 
    ON emp.role_id = 1; -- because this is the role_id for 'tech'


This means that you don't define a condition about how to join the two tables.  In turn, this results in a Cartesian product of role (without any restriction about which rows to return) and emp (where role_id is 1).

Again rewriting the query, it is effectively a CROSS JOIN:

SELECT emp.name, role.role_name, emp.emp_id 
FROM emp 
CROSS JOIN role 
WHERE emp.role_id = 1;


See them on SQLFiddle.

What you possibly want is

SELECT emp.name, role.role_name, emp.emp_id 
FROM emp 
INNER JOIN role 
    ON emp.role_id = role.role_id
WHERE emp.role_id = 1;