You have two different sources for the same contact where your identifier is also the same. But a contact identifier uniquely identifies a contact by a combination of
Source. To understand that, it is a correct approach let take an example of Twitter and Facebook as two sources and identifiers as the username of both sources. Now if you have username "krishnagupta" on Facebook it doesn't guarantee that you will have the same username on Twitter as well. Technically this is possible that somebody else with the same "krishnagupta" username from twitter visits the website and you visit the website with the same username "krishnagupta" but from facebook and this will be a separate contact in Sitecore.
Identifiers are represented by the Sitecore.XConnect.ContactIdentifier class, which includes -
Identifier, such as a username, email, etc.
identifier Source, which describes where the identifier comes from, such as Facebook, Twitter or email campaigns
identifier ContactIdentifierType - which is either
A contact merge is triggered when a returning anonymous contact that already exists in
xConnect identifies as a known contact. In your case, you have two interactions with different contact identities, Let's assume you have the second interaction as anonymous, so during this second interaction, the anonymous contact will only identify as a known contact if it comes from the same source which is false in your case.
mergeContacts pipeline -
\App_Config\Sitecore\Marketing.Tracking\Sitecore.Analytics.Tracking.config executes on the CD server and do the merge operation, which @Swati is talking about. You can try this but I have doubts about it because since your contact does not exist in xConnect(different identity) so tracker will not call the pipeline.
What you are seeing is technically correct.