@karthik palani , Thanks for posting in Q&A.
While creating the Domain Join configuration profile in Intune, the Computer names are 15 characters long and only allows a prefix followed by a random set of characters.
https://learn.microsoft.com/en-us/mem/intune/configuration/domain-join-configure#create-the-profile
For your situation, you can add Windows Autopilot Group tag for the computers in different department. And set different Dynamic groups for different departments. Then deploy different domain join profiles for them. Here is a link for your refence:
https://www.anoopcnair.com/computer-name-during-windows-autopilot-intune/
Note: Non-Microsoft link, just for the reference.
If the above still didn't met your requirement, the following is a link describe to use script to rename computer name, you can also read it as a reference to see if it can help.:
https://oofhours.com/2020/05/19/renaming-autopilot-deployed-hybrid-azure-ad-join-devices/
Note: Non-Microsoft link, just for the reference.
Hope it can help.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.