Birth tourisim is not illegal but for sure is discouraged given too many people come to Canada either not realising how much they need to pay for a birth or simply give birth and then do not pay.
Applying for a TRV by just stating you ae coming to give birth it is possible will be refused.
Do you have the funds for a birth which could maybe be in range 5000-10000 dollars or significantly more if a cesarean or if complications requiring ICU care. One case in last few years reached a few hundred thousand which the parents are liable for.
Giving birth in Canada gives the parents zero rights so keep that in mind. Also even entering as a tourist there is no guarantee that any authorised stay may be long enough to both give birth or stay post birth for any period of time.
As for hiding the pregnancy as you read in below link refusing entry based on being pregnant is not necessarily a sole reason as opposed to being able to fund and leaving when told to do so.
Not advisable in any way to mislead CBSA at any border as that could have serious consequences if discovered so to hide or not is your decision not something anyone here would recommend.
https://www.canada.ca/en/immigration-refugees-citizenship/corporate/publications-manuals/operational-bulletins-manuals/temporary-residents/visitors/persons-wishing-enter-canada-purpose-giving-birth.html
You will not find many positive comments on here about birth tourists given apart from payment many people see birth tourists taking up valuable resources that residents see as their entitlement