<p>How do I create subdomain like <code>http://user.mywebsite.example</code>? Do I have to access <code>.htaccess</code> somehow? Is it actually simply possible to create it via pure PHP code or I need to use some external script-server side language?</p>
<p>To those who answered: Well, then, should I ask my hosting if they provide some sort of DNS access?</p>

In addition to configuration changes on your WWW server to handle the new subdomain, your code would need to be making changes to your DNS records.  So, unless you're running your own BIND (or similar), you'll need to figure out how to access your name server provider's configuration.  If they don't offer some sort of API, this might get tricky.
Update: yes, I would check with your registrar if they're also providing the name server service (as is often the case).  I've never explored this option before but I suspect most of the consumer registrars do not.  I Googled for GoDaddy APIs and GoDaddy DNS APIs but wasn't able to turn anything up, so I guess the best option would be to check out the online help with your provider, and if that doesn't answer the question, get a hold of their support staff.