pc is just an workstation, it doesn't have any configuration to know anything about its network.
when pc3 tries to connect to pc4...hmm that doesn't happen exactly.
what it really happens is,
1. pc3 goes into the switch with vlan tag 2 header with destination pc4 in it.
2. although the switch sees they belong to the same subnet, vlan causes pc3 and pc4 to exist in different network.
3. so switch cannot find the destination address, therefore it fowards that frame to its gateway (router).
4. the router detects the pc4's address, where it swaps vlan2 header to vlan3. then, it enters back to pc4.
the concept of VLAN is like poor man's switch. If you can't affort 2 switches then, just buy one then create VLANs.
so, you can safely say, VLAN is like a separate Switch.
VLAN2 = Switch2
VLAN3 = Switch3
So logically, pc1,pc2,and pc3 is connected to switch2 which connected to a router, and pc4 is connected to switch3 which connect to a same router.
To answer your second question:
First time around, when newly connected pc3 wants to connect to pc1 or pc2, the "switch2" sends it to its default gateway because of different subnet like you said but it sends back to the "switch2" where then switch stores pc3's MAC address which next time around it could just foward within the "switch2" without send it to the router.